C# 找不到配置绑定扩展“system.serviceModel/bindings/basicHttpsBinding”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18239749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Configuration binding extension 'system.serviceModel/bindings/basicHttpsBinding' could not be found
提问by Darian Everett
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:
当我尝试导航到我的 .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"/>
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.
我尝试通过 Google 进行搜索,但我能找到的任何答案似乎都不适用于我在这里所做的事情。我发现的大部分内容都是关于自定义绑定的,我认为我没有。老实说,我什至不确定是什么导致了这个错误,所以任何帮助都将不胜感激。如果您需要更多信息,请告诉我,我会添加它。
采纳答案by slfan
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
.
BasicHttpsBinding
是 .NET 4.5 中的新绑定,因此您不能在 4.0 应用程序中使用它。要么删除 protocolMapping,要么使用另一个绑定,例如basicHttpBinding
或wsHttpBinding
。
When you configure SSL in IIS, this should work as well.
当您在 IIS 中配置 SSL 时,这也应该有效。
回答by user919426
If you have a similar scenario as mine where the Visual Studio-generated Web.config
has the following configs:
如果您有与我类似的场景,其中 Visual Studio 生成的Web.config
具有以下配置:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<pages controlRenderingCompatibilityVersion="4.0" />
</system.web>
... add <httpRuntime targetFramework="4.5" />
... 添加 <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.
我也继续删除<pages controlRenderingCompatibilityVersion="4.0" />
,对我的情况没有影响。
回答by Adem Sipahi
Remove protocolMapping
section from web.config
and it will work.
protocolMapping
从中删除部分web.config
,它将起作用。