【问题标题】:Website Deployment in IIS : IIS can't access directories?IIS 中的网站部署:IIS 无法访问目录?
【发布时间】:2020-01-28 14:52:46
【问题描述】:

我在本地机器上的 Visual Studio 2019 中的 ASP.NET Core 中做了一个应用程序,然后在为我的文件系统部署后,我将文件复制到服务器。同时,我在服务器(Windows Server)上创建了一个新的 IIS 站点,指示我想要的设置,包括使用 https。

但是,当我尝试访问该站点时出现错误,显然 IIS 无法访问程序文件夹...

当我尝试在 IIS 中导航网站设置并单击以查看连接字符串时,IIS 给出了图片中的错误。其实好像路径有问题。 \\?\C:\mydir\web.config 是什么意思?

谁能帮我解决这个错误?我确信我指出了 IIS 的正确路径。

【问题讨论】:

  • 您忘记在 IIS 上安装 ASP.NET Core 模块。就是这样。
  • 您能分享一下您的 web.config 文件吗?如果您使用 url 重写规则,请确保您安装了 iis url rewrite 扩展。并检查您是否安装了 iis 的 asp.net 功能。确保已安装 .NET Core Windows Server Hosting 包。

标签: asp.net-mvc iis web-deployment windows-server


【解决方案1】:

我已经安装了 .NET Hosting Bundle,上面的问题就解决了。 但是,现在,我仍然无法访问我创建的网站。浏览器给出错误DNS_PROBE_FINISHED_NXDOMAIN

这是我的 web.config 文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\MVF2.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 99f7528d-8954-427a-86a5-7124668717df-->

Program.cs 文件是:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace MVF2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .UseKestrel(options =>
                {
                    options.Listen(IPAddress.Loopback, 8088, listenOptions =>
                    {
                        listenOptions.UseHttps("mycertificate.crt");
                    });
                });
    }
}

【讨论】:

    猜你喜欢
    • 2020-05-16
    • 1970-01-01
    • 1970-01-01
    • 2012-10-22
    • 2011-10-06
    • 2012-11-27
    • 1970-01-01
    • 1970-01-01
    • 2011-11-05
    相关资源
    最近更新 更多