IIS 10 服务堆栈.Net4.8 404

IIS 10 ServiceStack .Net4.8 404

我最近在我的一个项目中升级到了 .Net Framework 4.8 和 ServiceStack 5.6.0。 当我通过 IIS Express 在 Visual Studio 中 运行 它工作正常,但在 IIS 中我得到以下内容。

HTTP 错误 404.0 - 未找到 您要查找的资源已被删除、更名或暂时不可用。

有人遇到过类似的问题吗?

Windows 10 - IIS 10

以下是我的web.config:(我认为相关的部分)

  <system.web>
    <compilation targetFramework="4.8" />
    <pages controlRenderingCompatibilityVersion="4.0" />
  </system.web>

 <system.webServer>
   <directoryBrowse enabled="true" />
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
    <add path="*" name="ServiceStack.Factory" 
    type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" 
    preCondition="integratedMode" resourceType="Unspecified" 
    allowPathInfo="true" />
   </handlers>
 </system.webServer>

另一件事这是我的 ServiceStack 版本

<package id="ServiceStack" version="5.6.0" targetFramework="net48" />
  <package id="ServiceStack.Client" version="5.6.0" targetFramework="net48" />
  <package id="ServiceStack.Common" version="5.6.0" targetFramework="net48" />
  <package id="ServiceStack.Interfaces" version="5.6.0" targetFramework="net48" />
  <package id="ServiceStack.Text" version="5.6.0" targetFramework="net48" />

疑难解答:

我打开了内部日志记录,我能够看到来自全局(方法 Application_Start)的日志,它调用 ServiceStack AppHost().Init() 也 运行s 没有错误并执行 Configure().

我的Application_Start:

    protected void Application_Start(object sender, EventArgs e)
    {
        log4net.Config.XmlConfigurator.Configure();
        Logger.LogInfo("Global Application_Start prior AppHost().Init()");
        new AppHost().Init();
        Logger.LogInfo("Global Application_Start done");
    }

我的 AppHost 配置()

    public override void Configure(Funq.Container container)
    {
        try
        {
            Logger.LogInfo("AppHost Configure");
            //plugins
            Plugins.Add(new CorsFeature());
            Plugins.Add(new PostmanFeature());
            Plugins.Add(new ValidationFeature());

        }
        catch (Exception ex)
        {
            Logger.LogException(ex);

            if (ex.InnerException != null)
                throw new Exception(ex.InnerException.Message);
            else
                throw new Exception(ex.Message);
        }
    }

以上两种方法执行都没有错误,不用说看到这个项目通过Visual Studio在IIS express中运行成功了。 我确定它是 IIS 或配置错误我只是不确定是什么,我的 .Net 4.7.2 项目 运行 没有问题。

问题似乎是我在 IIS 的一个网站下托管了 2 个应用程序,通常这不是问题,但在我的情况下,我的一个网站是 .net 4.8,另一个是 .net 4.7。

为了解决问题,我为每个应用程序创建了一个网站并解决了我的问题。 过去我可以混合使用 .Net4.5 和 .Net 4.7 应用程序,但在使用 .net 4.8 时似乎不起作用。