3

我们有一个使用 System.Transactions 命名空间的 C# ASP.NET Web 应用程序。

using System.Transactions;

这在本地开发时工作得很好——我们只需要首先通过转到网站来添加引用 --> 添加引用...

问题是在部署到 web 主机(通过 FTP 复制)之后,主机不知道这个引用。

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'Transactions' does not exist in the namespace 'System' (are you missing an assembly reference?)

在 Visual Web Developer Express 2010 中工作,我们没有内置 References 文件夹。我看到了这个解决方案:https ://stackoverflow.com/a/13035466/2178080建议(但不推荐)将 dll 复制到应用程序文件夹。

我对使用 ASP 进行部署有点陌生,不知道如何包含 System.Transactions 库,以便主机可以找到参考。有没有人遇到过这个问题?

编辑:我们采用将 dll 与应用程序一起复制到站点的路线。执行此操作的步骤:

  1. 从本地系统复制 System.Transactions.dll。
  2. 粘贴到 Bin 文件夹中。
  3. 此程序集中引用的对象现在必须使用完全限定名称。

由于此解决方案被列为不推荐,我仍然对其他解决方案持开放态度。

Edit2: Grant 和 Chris 帮助我了解我使用的是网站而不是 Web 应用程序。格兰特帮助解决了网站问题的细节。

4

2 回答 2

9

您的问题是由于发布的站点没有附带 System.Transactions.dll,这表明“复制本地”设置为 False,因此 DLL 没有复制到 bin 文件夹。

转到References -> System.Transactions并确保在此引用的属性上“复制本地”设置为True

于 2013-04-25T15:36:45.233 回答
0

检查 IIS 中的目标框架,确保它设置为与编译代码相同的 .Net 版本。如果您使用的是具有应用程序池的 IIS 7+,请确保运行应用程序的池是相同版本的.Net。

于 2013-04-25T15:03:43.040 回答