Error 2 The type or namespace name 'ConnectionOptions' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\user\Documents\Visual Studio 2010\WebSites\Service\App_Code\PService.cs 55 10 C:\...\Service\
尝试使用
中的代码时 [WebMethod]
public ConnectionOptions remoteconnection(string MyComputerName, string ip)
{
ConnectionOptions connOptions = new ConnectionOptions();
return connOptions ;
}
虽然在webApplication中复制时相同的代码没有错误。我已经在两个文件中都使用了system.Management ..
答案 0 :(得分:1)
您定义了System.Managment的命名空间,但这还不够。定义只是让 您访问没有全名的类(使用命名空间)。启用ASP.NET 知道键入对包含该类型的程序集的引用 必要。使用"添加引用"添加引用子菜单下 "项目"菜单。 然后检查System.Management项并添加项目的引用。