简体   繁体   中英

WebService Parser Error

I've created a web service (hello world) in VS and when I run the web service I get the following error message:

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 'UpdaterWS.Service1'.

Source Error:

Line 1: <%@ WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="UpdaterWS.Service1" %>

How can I fix this?

code:

namespace WebService1HelloTest
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
 public class Service1 : System.Web.Services.WebService
{
[WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}

你添加服务后重建了吗?

Your service is in the WebService1HelloTest namespace, but you're referring to the UpdaterWS namespace.

Why are you using ASMX services in any case? That's a legacy technology that shouldn't be used for new development.

As John Saunders said, your service is in the WebService1HelloTest namespace, but you're referring to the UpdaterWS namespace.

To fix it, right click on your WebService1HelloTest.asmx file and select View Markup. You will see that your Class is referring to UpdaterWS.Service1. Change it to WebService1HelloTest.HelloWorld and you should be ready to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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