我想创建一个宁静的WCF Web服务。 当我尝试连接到通过客户端我收到以下错误的服务:
该服务无法启动,因为它不支持ASP.NET兼容性。 ASP.NET兼容性为该应用程序启用。 关闭ASP.NET兼容模式在web.config或AspNetCompatibilityRequirements属性添加到与RequirementsMode设置为“允许”或“必需”的服务类型。
其他人有问题,但他们固定它通过改变他们的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>