【问题标题】:HTTP Error 403.14 - Forbidden on windows 7 using visual studio 12 for creating a web serviceHTTP 错误 403.14 - 在 Windows 7 上禁止使用 Visual Studio 12 创建 Web 服务
【发布时间】:2013-02-01 08:12:26
【问题描述】:

您好,我想创建一个示例 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;
        }

    }
}

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

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

我的 IIS 设置如下:

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

请告诉我如何摆脱它。

【问题讨论】:

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


    【解决方案1】:

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

    希望对你有帮助

    【讨论】:

    • 当我在“/”应用程序中给出localhost:50383/simpleMethod.aspx 服务器错误时,我遇到了错误。无法找到该资源。说明:HTTP 404。您正在查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请查看以下 URL 并确保其拼写正确。请求的 URL:/simpleMethod.aspx 版本信息:Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.17929 你能告诉我如何放置默认文档吗?
    【解决方案2】:

    附注,确保你有正确的启动项目集(我调试 .net 已经很久了:p)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-29
      • 1970-01-01
      • 2012-07-10
      • 2015-12-08
      • 2013-07-11
      相关资源
      最近更新 更多