问题描述
|
我正在尝试测试使用WCF Web服务的MVC应用程序。当我在VS2010中使用开发服务器运行它时,它运行良好。但是,当我在IIS7上部署它并尝试在控制器代码中调用任何服务方法时,出现以下错误:
(405)不允许的方法
有谁知道如何解决这个问题?
我的Web配置条目如下:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name=\"BasicHttpBinding_IAuthenticationService\" closeTimeout=\"00:01:00\"
openTimeout=\"00:01:00\" receiveTimeout=\"00:10:00\" sendTimeout=\"00:01:00\"
allowCookies=\"false\" bypassproxyOnLocal=\"false\" hostNameComparisonMode=\"StrongWildcard\"
maxBufferSize=\"65536\" maxBufferPoolSize=\"524288\" maxReceivedMessageSize=\"65536\"
messageEncoding=\"Text\" textEncoding=\"utf-8\" transferMode=\"Buffered\"
useDefaultWebProxy=\"true\">
<readerQuotas maxDepth=\"32\" maxStringContentLength=\"8192\" maxArrayLength=\"16384\"
maxBytesPerRead=\"4096\" maxNaMetableCharCount=\"16384\" />
<security mode=\"None\">
<transport clientCredentialType=\"None\" proxyCredentialType=\"None\"
realm=\"\" />
<message clientCredentialType=\"UserName\" algorithmSuite=\"Default\" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address=\"http://SiteName/ServiceName/AuthenticationService.svc\"
binding=\"basicHttpBinding\" bindingConfiguration=\"BasicHttpBinding_IAuthenticationService\"
contract=\"AuthService.IAuthenticationService\" name=\"BasicHttpBinding_IAuthenticationService\">
</endpoint>
</client>
</system.serviceModel>
解决方法
听起来像是旧的“未安装ASP.NET或向IIS注册”问题,请尝试使用进行注册
aspnet_regiis –i –enable
从以管理员权限运行的命令提示符中。
, h ... WCF服务和MVC应用程序的.NET版本不匹配! :(愚蠢的我。