我在Visual Stdio 2008中创建了一个示例C#ASP .NET Web服务。我收到错误
System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID
错误代码80040154
同时尝试将项目作为参考。
错误An attempt was made to load a program with an incorrect format
无法在添加DLL作为参考时加载程序集错误。
编辑:我能够在C#Console应用程序项目中调用相同的dll并访问其中的函数。 我只是在webservice项目中调用它时才收到错误。
以下是我的Service1.asmx.cs
的内容using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using COMClient;
namespace DLLWebService
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public string GetInfo()
{
COMClient.DLLCOMWrapper obj = new COMClient.DLLCOMWrapper();
//String returnedInfo = obj.Info();
return "hi";
}
}
}