我刚刚安装了IIS,所以我可以在浏览器中查看asp文件,但是当我将地址放在浏览器中时:http://localhost/index.asp我收到错误.
错误显示:
HTTP错误401.3 - 未经授权由于Web服务器上此资源的访问控制列表(ACL)配置或加密设置,您无权查看此目录或页面.
我真的需要解决这个问题,我非常感谢你提出这方面的建议.
我在IIS 10上运行的ASP.NET Core Web应用程序有问题.我正在使用AngularJS开发单页应用程序.
index.html完全加载,但后端请求在IIS 10上失败,并显示404错误代码.从带有IIS Express的Visual Studio中,它完美地运行.
任何人都可以发现我如何修复后端请求?
这是我的Program.cs
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
Run Code Online (Sandbox Code Playgroud)
这是Startup.cs中的配置方法
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseIdentity();
// Custom middleware for Angular UI-Router
app.Use(async (context, next) =>
{
if (!Path.HasExtension(context.Request.Path.Value)
&& context.Request.HttpContext.Request.Headers["X-Requested-With"] != "XMLHttpRequest"
&& context.Request.Method.ToUpper() != "POST"
&& context.Request.Method.ToUpper() != "PUT"
&& context.Request.Method.ToUpper() != "DELETE")
{
await context.Response.WriteAsync(File.ReadAllText(env.WebRootPath + "/index.html"));
}
await next();
});
app.UseMvc(routes …Run Code Online (Sandbox Code Playgroud)