asp.net - HTTP 错误 403.14 - 禁止在 Windows 7 上使用 visual studio 12 创建 Web 服务

标签 asp.net .net http windows-7 iis-7.5

您好,我想创建一个示例 Web 服务,我是新手,但是当我运行我的 Web 服务程序时,出现以下错误。其他详细信息如下 --

我的 AssemblyInfo.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace MyFirstWebService
{
    /// <summary>
    /// Summary description for Service1
    /// </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 Service1 : System.Web.Services.WebService
    {
        [WebMethod]
        public string simpleMethod(String srt)
        {
            return "Hello " + srt;
        }

        [WebMethod]
        public int anotherSimpleMethod(int firstNum, int secondNum)
        {
            return firstNum + secondNum;
        }

    }
}

当我运行这个时,我得到了

enter image description here

下面是我的 Windows 功能和服务的快照 --

enter image description here

我的 IIS 设置如下:

enter image description here

我在我的 cmd 上运行了以下命令 %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

请告诉我如何摆脱它。

最佳答案

“默认文档”(default.aspx、default.asp、index.htm 等)似乎在您的 Web 应用程序中不可用。 因此,未启用“目录浏览”错误。 尝试打开 web 服务的 url,例如 http://localhost:[port]/webservicename.aspx

希望对你有帮助

关于asp.net - HTTP 错误 403.14 - 禁止在 Windows 7 上使用 visual studio 12 创建 Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14910184/

相关文章:

asp.net - Glimpse - 如何在 IRuntimePolicy 中访问 HttpContext.Session

c# - 将对象从一个 Aspx 从 Javascript 传递到另一个

c# - 使用 Dapper 的 IDbConnection 工厂

c# - http 元刷新问题

javascript - session 结束时如何从 Global.asax 重定向到 login.aspx 页面

.net - VB stringbuilder 包含

c# - 我怎样才能改进这个设计?

symfony - 在symfony(Doctrine)中更新实体时图片被删除

java - 使用 ICAP 和 Java 发送文件并接收响应

apache 重定向 301 从 https ://www. domain.com 到 https ://domain. com