.NET C#Office共享加载项WCF服务引用异常



我使用Visual Studio 2010.NET 4.0创建了一个office共享加载项。此加载项引用WCF服务。当创建WCF服务客户端的实例时,我得到以下异常:

在ServiceModel客户端配置节中找不到引用约定"Services.IBusinessLogicLayerMetaData"的默认终结点元素。这可能是因为找不到应用程序的配置文件,或者因为在客户端元素中找不到与此约定匹配的端点元素。

我不知道如何解决这个问题。我的app.config如下所示:

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

希望这能帮助到别人。

我通过将加载项配置文件和dll复制到office目录来解决这个问题。我还复制了配置文件,并将其重命名为"OfficeApplication".exe.config.

"OfficeApplication"是您希望外接程序使用的office应用程序。

最新更新