我使用VS2013在名为 Publish_test 的Web应用程序中创建了Web服务 Webservice.asmx 。每件事都在找工作,但当我把它发布到主机时我得到了这个错误:
Server Error in '/' 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 'Publish_test.MyWebService.WebService'.
Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="~/WebService.asmx.cs" Class="Publish_test.MyWebService.WebService" %>
Source File: /test/test/MyWebService/WebService.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5483
我的网络服务代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace Publish_test.MyWebService
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://src-services.com/test/test/")]
[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 WebService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
答案 0 :(得分:0)
change
CodeBehind="~/WebService.asmx.cs" to CodeFile="~/WebService.asmx.cs"
答案 1 :(得分:0)
将ftp主机中的Web服务内容定义为应用程序池