我是.net的新手,我必须创建一个用于连接android.i的web服务得到一个简单的示例代码,我把它放在一个新的webservice应用程序中并在调试模式下运行它。但它显示以下错误firefox.pls有助于纠正它。
Service1.asmx.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
namespace HelloAndroid
{
[WebService(Namespace = "http://sample.com/")]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string SayHello()
{
return "Hello, Android from .NET";
}
}
}
错误
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 'WebService1.Service1'.
Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="WebService1.Service1" %>
Source File: /Service1.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.6387; ASP.NET Version:2.0.50727.6387
答案 0 :(得分:0)
您可能已在WebService1
中将名称空间从HelloAndroid
更改为Service1.asmx.cs
。您还需要更新Service1.asmx
文件。