简体   繁体   English

在 asp.net 中重命名 web 服务的问题

[英]problem renaming web service in asp.net

I am trying to rename the webservice i made in asp.net website.我正在尝试重命名我在 asp.net 网站上创建的 web 服务。 I made the changes as below but still it gives error as "cannot create FileUploading.FileService" even in.cs file also i changed the class name but it still gives error.我进行了如下更改,但仍然出现“无法创建 FileUploading.FileService”的错误,即使在.cs 文件中,我也更改了 class 名称,但仍然出现错误。

  <%@ WebService Language="C#" CodeBehind="MyService.asmx.cs"
      Class="FileUploading.MyService" %>

to

  <%@ WebService Language="C#" CodeBehind="FileService.asmx.cs" 
      Class="FileUploading.FileService" %>

I'm not having any idea where the problem is.我不知道问题出在哪里。 Can you help me?你能帮助我吗?

Believe it or not but the system isn't lying to you:)信不信由你,但系统不会对你撒谎:)

If it says it cannot create the type it means that the type is not defined anywhere.如果它说它无法创建类型,则意味着该类型未在任何地方定义。 How are you hosting the project?你是如何主持这个项目的?

Sometimes you may need to stop the local development web server for some changes to be recognized (since everything may still be loaded).有时您可能需要停止本地开发 web 服务器以识别某些更改(因为可能仍会加载所有内容)。

Double-check to make sure your fully qualified class name is 100% correct.仔细检查以确保您完全合格的 class 名称 100% 正确。

Couldn't create type must mean the absence of the namespace FileUploading无法创建类型必须意味着缺少namespace FileUploading

Wrap everything inside FileUploading like this.像这样将所有内容包装在 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    
    }    
}

or if you would like to omit the namespace altogether, change your asmx like或者如果您想完全省略命名空间,请更改您的 asmx

<%@ WebService Language="C#" CodeBehind="FileService.asmx.cs" Class="FileService" %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM