Asp.net 访问web服务时编译ASMX时出错

Asp.net 访问web服务时编译ASMX时出错,asp.net,Asp.net,我有一个ASMX网络服务。当我从客户端访问它时,会编译ASMX,但我得到以下错误: 从错误详细信息查看csc.exe命令行时,未引用System.Windows.Forms组件 编译错误 描述:编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码 Compiler Error Message: CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are

我有一个ASMX网络服务。当我从客户端访问它时,会编译ASMX,但我得到以下错误:

从错误详细信息查看csc.exe命令行时,未引用System.Windows.Forms组件

编译错误

描述:编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码

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

Source Error:

Line 3:  using System.ComponentModel;
Line 4:  using System.Drawing;
Line 5:  using System.Windows.Forms;
Line 6:  using System.Xml;
Line 7:  using Idp.Core.Configuration;

出现此问题至少有两个原因:

在本例中,所需的程序集System.Windows.Forms未被项目引用。您可以通过在VisualStudio中添加对项目的引用来解决此问题,如果需要,还可以重新部署站点。 using语句是多余的。有时我会在文件中使用不需要的语句。如果未使用,删除第5行应该可以解决问题。
System.Windows.Forms被项目引用,我使用了其中的一些类。我不理解与引用的程序集没有传递给compiler@Frederic-您的C代码是在标记文件中还是在代码隐藏中?