1

I'm trying to call a WCF endpoint from an outlook plugin, but it always throws this error:

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.

My app.config file looks like this:

<?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>

When I call the service from a console application (with the same App.config), it works. I think my references are also correct. What can be the problem?

gkatai
  • 416
  • 4
  • 10

1 Answers1

0

Note, you develop an add-in, not a standalone application. All configuration is made using the host application config file. You need to run the following code to get the app.config working:

Appdomain.SetData("APP_CONFIG_FILE",@"D:\myapp\app.config");

See Problem with excel add-in and app.config for more information.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45