[英]Problem adding assembly reference to WCF web.config
我正在嘗試在 IIS 中托管 WCF 服務,以便我可以從 Z9A06BECFED1DBBCC6ZF 訪問 net.tcp 綁定我一直在按照本教程中的步驟進行操作:
http://msdn.microsoft.com/en-us/library/ms733766.aspx
我可以獲得一個簡單的示例類型服務來工作,但是當我嘗試一個真實的項目時,我遇到了以下問題:
Line 6: using NUnit.Framework;
CS0246: The type or namespace name 'NUnit'
could not be found (are you missing
a using directive or an assembly reference?)
我知道你在想什么,是的,這是真的。 我單元測試。
我的目錄結構如下所示:
根目錄:service.svc 和 app_code\
app_code:項目文件,web.config,bin\ 以及各種目錄中的大量代碼
bin:調試文件夾
調試:nunit dll 和項目二進制文件。
我嘗試將以下內容添加到我的 web.config 中:
<compilation>
<assemblies>
<add assembly="nunit.framework"/>
</assemblies>
</compilation>
我已經玩過adding.dll 和路徑名等,但它們都會導致:
Could not load file or assembly
'nunit.framework' or one of its dependencies.
The system cannot find the file specified.
我如何讓魔法發生?
工具:VSE2010、IIS7 Express、MS WebMatrix
編輯:將 web.config 文件更改為:
<add assembly="nunit.framework, Version=2.5.9.10348, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"/>
正如史蒂夫所建議的那樣,答案是=)
首先,我將使用程序集的完全限定名稱。 10 次中有 9 次可以解決您的問題。 如何:確定程序集的完全限定名稱另外,請確保程序集及其所有依賴項位於 GAC 或 BIN 文件夾中。
然后,如果您仍然遇到問題,Fusion 會告訴您到底發生了什么: MSDN 上的 Fusion Log Viewer Documentation
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.