开发者

.NET C# Office Shared Add In WCF Service reference exception

开发者 https://www.devze.com 2023-03-18 12:27 出处:网络
I have created an office shared add in using Visual Studio 2010 .NET 4.0. This add in references a WCF service. When creating an instance of the WCF service client, i get the following exception:

I have created an office shared add in using Visual Studio 2010 .NET 4.0. This add in references a WCF service. When creating an instance of the WCF service client, i get the following exception:

Could not find default endpoint element that references contract 'Services.IBusinessLogicLayerMetaData' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

I am not sure how to resolve this. My app.config looks like this:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IBusinessLogicLayerMetaData" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="1048576000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
开发者_StackOverflow中文版      <endpoint address="http://10.181.9.47:8000/DeutscheBank.WindowsServices.DataSOA/BusinessLogicLayerMetaDataService" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBusinessLogicLayerMetaData" contract="Services.IBusinessLogicLayerMetaData" name="WSHttpBinding_IBusinessLogicLayerMetaData" />
    </client>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>


Hope this helps someone.

I resolved this issue by copying the add in config file and dll to the office directory. I also made a copy of the config file and renamed it to "OfficeApplication".exe.config.

"OfficeApplication" is the office app that you would like the add in to work with.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号