c# - 无法在 iis 上托管 ASMX Web 服务

标签 c# web-services iis iis-6 asmx

我在网站项目中创建了一个Web服务(在vs 2010中)。在 Visual Studio 中,当我运行此网站时,我可以看到此 Web 服务,如下所示:

enter image description here

网络服务的主体是:

/// <summary>
/// Summary description for WebService
/// </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 WebService : System.Web.Services.WebService {

public WebService () {

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
}

[WebMethod]
public int Plus(int x, int y)
{
    return x + y;
}

[WebMethod]
public int Multiply(int x, int y)
{
    return x * y;
}

}

我通过以下步骤在 iis 6 上托管此网站:

  • 1) 右键单击​​“网站”节点,单击“添加新网站”选项 IIS。

    2) 为其分配端口(对于 ex 1919 端口)

    3) 下一步指定网站的物理路径

    4) 指定访问级别权限

    5)完成

现在我想调用以下地址,并给出此错误: enter image description here

我重新启动了iis,但没有发生任何事情。

我想在本地使用这个网络服务,为什么会发生这个错误?怎么解决?

最佳答案

创建虚拟目录时选中“执行(例如ISAPI应用程序或CGI)”复选框

关于c# - 无法在 iis 上托管 ASMX Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16808137/

相关文章:

iis - HTTP 错误 403.16 - 客户端证书信任问题

c# - DataGridView 动态更改数据源

c# - Windows Phone 7 ListPicker InvalidCastException

web-services - 如何解决JAX_WS Web服务调用 "MustUnderstand headers are not understood"的失败?

.net - 设计长期运行、资源密集型 Web 服务的建议

iis - MSDeploy 通过 FTP 发布

c# - 枚举到字符串 C# 和 JavaScript

c# - 是否可以将 IHttpClientFactory 注入(inject)强类型客户端?

ruby-on-rails - 在 Rails 中创建 Web 服务

iis - Coldfusion - 避免特定文件的 IIS 404.0 错误并改为手动路由