Configuration binding extension 'system.servic

2019-03-18 03:09发布

I am getting this error when I try to navigate to my .svc file. It appears that it's not finding my basicHttpsBinding; here's that section of my 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"/> 

I tried searching through Google but any answers I could find didn't seem to apply to what I'm doing here. Most of what I found talked about custom bindings, of which I don't think I have any. I'm honestly not even close to sure what could be causing this error, so any help would be greatly appreciated. If you need more information let me know and I'll add it.

3条回答
我想做一个坏孩纸
2楼-- · 2019-03-18 03:34

BasicHttpsBinding is a new binding in .NET 4.5, therefore you cannot use it in a 4.0 application. Either you remove the protocolMapping or you use another binding such as basicHttpBinding or wsHttpBinding.

When you configure SSL in IIS, this should work as well.

查看更多
何必那么认真
3楼-- · 2019-03-18 03:48

Remove protocolMapping section from web.config and it will work.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-03-18 03:56

If you have a similar scenario as mine where the Visual Studio-generated Web.config has the following configs:

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <pages controlRenderingCompatibilityVersion="4.0" />
  </system.web>

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

So that you now have

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <pages controlRenderingCompatibilityVersion="4.0" />
    <httpRuntime targetFramework="4.5" /> 
  </system.web>

I also went on to remove <pages controlRenderingCompatibilityVersion="4.0" /> with no impact in my situation.

查看更多
登录 后发表回答