首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >WCF web服务错误:无法激活该服务,因为它不支持ASP.NET兼容性

WCF web服务错误:无法激活该服务,因为它不支持ASP.NET兼容性
EN

Stack Overflow用户
提问于 2012-08-10 22:52:40
回答 4查看 84.8K关注 0票数 55

我正在尝试创建一个create风格的wcf web服务。当我尝试通过客户端连接到服务时,我得到以下错误:

无法激活该服务,因为它不支持ASP.NET兼容性。已为此应用程序启用ASP.NET兼容性。在web.config中关闭ASP.NET兼容模式,或将AspNetCompatibilityRequirements属性添加到服务类型,并将RequirementsMode设置为“Allowed”或“Required”。

其他人也有问题,但他们通过更改web.config解决了这个问题。我已经实现了他们的修复,但问题仍然存在。这是我的web.config:

代码语言:javascript
复制
<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>
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11904202

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档