我正在尝试创建一个create风格的wcf web服务。当我尝试通过客户端连接到服务时,我得到以下错误:
无法激活该服务,因为它不支持ASP.NET兼容性。已为此应用程序启用ASP.NET兼容性。在web.config中关闭ASP.NET兼容模式,或将AspNetCompatibilityRequirements属性添加到服务类型,并将RequirementsMode设置为“Allowed”或“Required”。
其他人也有问题,但他们通过更改web.config解决了这个问题。我已经实现了他们的修复,但问题仍然存在。这是我的web.config:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="WebBehavior" >
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyServiceBehavior" name="myfirstwcf">
<endpoint address="ws" binding="basicHttpBinding"
contract="Imyfirstwcf" />
<endpoint address="ws2" binding="wsHttpBinding"
contract="Imyfirstwcf" />
<endpoint address="" behaviorConfiguration="WebBehavior"
binding="webHttpBinding"
contract="Imyfirstwcf" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled= "true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
https://stackoverflow.com/questions/11904202
复制相似问题