显示标签为“DotNet”的博文。显示所有博文
显示标签为“DotNet”的博文。显示所有博文

2014年6月6日星期五

System.ServiceModel.Activation.HttpModule

.NET 安装的顺序应该是先装 IIS,再装 VS.NET,如果次序反了,或者 IIS重装了,就需要使用aspnet_regiis.exe -i 来重新安装 IIS Mapping(主要用于aspx, asmx等文件的 Extention 的匹配)。在 C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705 目录下,运行下面的命令:aspnet_regiis.exe -i。


报错:不能加载 
System.ServiceModel.Activation.HttpModule
Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.TypeLoadException: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more inform ation about the eraaaaaror and where it originated in the code. Exception Details: System.TypeLoadException: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.

解决方法:
使用命令: c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru

2014年5月22日星期四

HTTP 错误 403.14 - Forbidden

重新注册asp.net4.0

1、返回的错误表明IIS缺少针对无后缀的MVC请求的映射,ASP.NET处理程序无法接收到请求。

2、要解决这个问题,首先确保ASP.NET MVC3已安装好,然后检查站点的处理程序映射,看是否存在下列映射:
ExtensionlessUrlHandler-Integrated-4.0
ExtensionlessUrlHandler-ISAPI-4.0_32bit
ExtensionlessUrlHandler-ISAPI-4.0_64bit

3、如果映射存在,请检查应用程序是否分配给了.NET Framework4.0的应用程序池。

4、如果映射不存在,你可以以管理员运行下面的命令注册:
32位机器:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
64位机器:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

2014年5月19日星期一

customErrors tag should then have its "mode" attribute set to "Off"

测试报错的接口,然后在PC端上访问时,报错为 webconfig 的一些信息。


页面报错信息:

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".


详细信息: 若要使他人能够从本地服务器计算机上查看此特定错误信息的详细信息,请在位于当前 Web 应用程序根目录下的“web.config”配置文件中创建一个 customErrors 标记。然后应将此 customErrors 标记的“mode”属性设置为“RemoteOnly”。若要使他人能够在远程计算机上查看详细信息,请将“mode”设置为“Off”。
注释: 通过修改应用程序的 customErrors 配置标记的“defaultRedirect”属性,使之指向自定义错误页的 URL,可以用自定义错误页替换所看到的当前错误页


其实际的意思就是,在PC端测试API时,出于安全原因,出现的内部服务器错误无法显示详细的信息,但是你可以在服务器端用浏览器测试API,来查看错误的详细信息。
但是,如果你非要在PC端测试API时,显示错误的详情,你也可以修改webconfig文件,添加 customErrors 标记

当然,这样是很不安全的。

所以,报错页面弹出了webconfig的一些信息,实际上并不是webconfig的问题。



页面报错截图: