[英]problem renaming web service in asp.net
我正在嘗試重命名我在 asp.net 網站上創建的 web 服務。 我進行了如下更改,但仍然出現“無法創建 FileUploading.FileService”的錯誤,即使在.cs 文件中,我也更改了 class 名稱,但仍然出現錯誤。
<%@ WebService Language="C#" CodeBehind="MyService.asmx.cs"
Class="FileUploading.MyService" %>
至
<%@ WebService Language="C#" CodeBehind="FileService.asmx.cs"
Class="FileUploading.FileService" %>
我不知道問題出在哪里。 你能幫助我嗎?
信不信由你,但系統不會對你撒謊:)
如果它說它無法創建類型,則意味着該類型未在任何地方定義。 你是如何主持這個項目的?
有時您可能需要停止本地開發 web 服務器以識別某些更改(因為可能仍會加載所有內容)。
仔細檢查以確保您完全合格的 class 名稱 100% 正確。
無法創建類型必須意味着缺少namespace
FileUploading
像這樣將所有內容包裝在 FileUploading 中。
namespace FileUploading
{
/// <summary>
/// Summary description for FileService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 FileService : System.Web.Services.WebService
{
//ctor
// your methods go here
}
}
或者如果您想完全省略命名空間,請更改您的 asmx
<%@ WebService Language="C#" CodeBehind="FileService.asmx.cs" Class="FileService" %>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.