.NET C# Office Shared Add In WCF Service 引用異常 (.NET C# Office Shared Add In WCF Service reference exception)


問題描述

.NET C# Office Shared Add In WCF Service 引用異常 (.NET C# Office Shared Add In WCF Service reference 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>
      <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>

‑‑‑‑‑

參考解法

方法 1:

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.

(by c0D3l0g1cc0D3l0g1c)

參考文件

  1. .NET C# Office Shared Add In WCF Service reference exception (CC BY‑SA 3.0/4.0)

#ms-office #office-addins #.net #wcf #C#






相關問題

什麼是 MS Office 對比算法? (What is the MS Office contrast algorithm?)

在 Office 2007 應用程序中使用 VBA? (Use VBA in Office 2007 Applications?)

複製 Word 腳註 (Copy Word Footnotes)

使用 WebApi 打開辦公文檔並使用 MS Office 保存回站點 (Open office documents with WebApi and save back to the site using MS Office)

用於確定 Windows 和 Office 版本的快速命令或批處理腳本 (quick command or batch script to determine Windows and Office version)

通過 Office 加載項將內容添加到 Outlook 電子郵件正文 (Adding content to an Outlook email body via an Office Add-In)

Word 2016 自動化生成“錯誤:80080005 服務器執行失敗” (Word 2016 automation generates "error: 80080005 Server execution failed")

Office 2016 查找激活日期 (Office 2016 find activation date)

Word 2007 文件啟動新窗口而不是顯示內聯 (Word 2007 files launching new window instead of displaying inline)

將 A1 公式和數組轉換為 L1C1 公式,反之亦然 (convert A1 formula and Array into L1C1 formula and vice-versa)

.NET C# Office Shared Add In WCF Service 引用異常 (.NET C# Office Shared Add In WCF Service reference exception)

從顯示“錯誤!超鏈接引用無效”的 MS Word 字段中恢復 URL (Recover URL from MS Word fields showing "Error! Hyperlink reference not valid")







留言討論