找不到配置绑定扩展'system.serviceModel/bindings/basicHttpsBinding'

Dar*_*ett 17 .net c# asp.net wcf web-config

当我尝试导航到我的.svc文件时收到此错误.它似乎没有找到我的basicHttpsBinding; 这是我的web.config的那一部分:

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/> 
Run Code Online (Sandbox Code Playgroud)

我尝试在谷歌搜索,但我找到的任何答案似乎都不适用于我在这里做的事情.我发现的大部分内容都谈到了自定义绑定,我认为我没有.老实说,我甚至不确定是什么导致了这个错误,所以任何帮助都会非常感激.如果您需要更多信息,请告诉我,我会添加它.

slf*_*fan 19

BasicHttpsBinding是.NET 4.5中的新绑定,因此您无法在4.0应用程序中使用它.要么删除protocolMapping,要么使用其他绑定,例如basicHttpBindingwsHttpBinding.

在IIS中配置SSL时,这也应该可以正常工作.


use*_*426 14

如果您有类似我的Visual Studio生成的场景Web.config具有以下配置:

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <pages controlRenderingCompatibilityVersion="4.0" />
  </system.web>
Run Code Online (Sandbox Code Playgroud)

......加 <httpRuntime targetFramework="4.5" />

所以你现在拥有

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <pages controlRenderingCompatibilityVersion="4.0" />
    <httpRuntime targetFramework="4.5" /> 
  </system.web>
Run Code Online (Sandbox Code Playgroud)

我也继续删除<pages controlRenderingCompatibilityVersion="4.0" />,对我的情况没有影响.