您好,我想创建一个示例 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
请告诉我如何摆脱它。
最佳答案
“默认文档”(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/