1
我試圖調用從Outlook插件一個WCF端點增加,但它總是拋出這個錯誤:調用Web服務
Configuration binding extension 'system.serviceModel/bindings/netHttpsBinding' could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that it is spelled correctly.
我app.config文件看起來是這樣的:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<system.serviceModel>
<bindings>
<netHttpsBinding>
<binding name="mainBinding" maxReceivedMessageSize="20000000">
<security mode="Transport" />
</binding>
</netHttpsBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="mainBehavior">
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="netHttpBinding" scheme="http" />
<add binding="netHttpsBinding" scheme="https" />
</protocolMapping>
<client>
<endpoint name="MyApp.MyClient" address="https://localhost:44332/Services/MyService.svc" binding="netHttpsBinding" bindingConfiguration="mainBinding" behaviorConfiguration="mainBehavior" contract="MyApp.IMyService">
</endpoint>
</client>
</system.serviceModel>
</configuration>
當我從控制檯應用程序(使用相同的App.config)調用服務時,它可以工作。我認爲我的參考也是正確的。 有什麼問題?