我正在尝试托管一个Web服务,我可以将它部署到服务器上,但是当我尝试运行它时,我得到“无法创建类型'LookUp.LookUpService'。”。
我已经在网上寻找解决方案,据我所知,它不是命名空间问题。它在调试中运行良好,但是当我尝试将其作为web服务添加到iis后尝试访问它时会抛出此错误。
这是我的代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace LookUp
{
/// <summary>
/// Summary description for LookUpService
/// </summary>
[WebService(Namespace = "http://tempuri.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.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 LookUpService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
这是我得到的错误。
Server Error in '/LookUp' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'LookUp.LookUpService'.
Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="LookUpService.asmx.cs" Class="LookUp.LookUpService" %>
Source File: /LookUp/LookUpService.asmx Line: 1
任何人都可以就我可能做错的事给我一些建议吗?
此致 卡尔