我正在做一个C#项目的维护工作,这个项目有WebServices。我创建了一个新的服务并运行了程序,它像下面的图片一样工作,但当调用按钮的方法时出现404错误。
我有其他类似的代码,但不能在这个项目中找到错误。
代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace ServicosMegasul
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[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 WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}图片



发布于 2016-03-19 04:57:31
从url访问服务和调用方法是不同的事情。你提到的错误是在另一种语言,我不能理解,但你有没有尝试添加绑定到web.congfig文件?
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>https://stackoverflow.com/questions/36092800
复制相似问题