ASP核心项目无法启动HTTP错误502.5-IIS进程失败

时间:2018-11-30 18:04:13

标签: asp.net iis .net-core

我不明白为什么这个项目没有开始。它的日志无法正常解释。我使用asp core,项目版本为1.0.1。我安装了.NET Core 1.1 Runtime&Hosting Bundle服务器,因为这是最新版本。我无法更新项目。

登录:

   info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
          User profile is available. Using 'C:\Users\Administrator\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
    info: Microsoft.EntityFrameworkCore.Storage.IRelationalCommandBuilderFactory[1]
          Executed DbCommand (120ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
          IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE') SELECT 1 ELSE SELECT 0
    info: Microsoft.EntityFrameworkCore.Storage.IRelationalCommandBuilderFactory[1]
          Executed DbCommand (106ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
          SELECT CASE
              WHEN EXISTS (
                  SELECT 1
                  FROM [AspNetUsers] AS [a])
              THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT)
          END
    crit: Microsoft.AspNetCore.Server.Kestrel[0]
          Unable to start Kestrel.
    System.AggregateException: One or more errors occurred. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.NativeMethods.uv_loop_size()
       at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle.Init(Libuv uv)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(Object parameter)
       --- End of inner exception stack trace ---
       at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
       at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.Start(Int32 count)
       at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
    ---> (Inner Exception #0) System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.NativeMethods.uv_loop_size()
       at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle.Init(Libuv uv)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(Object parameter)<---


    Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.NativeMethods.uv_loop_size()
       at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle.Init(Libuv uv)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(Object parameter)
       --- End of inner exception stack trace ---
       at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
       at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
       at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.Start(Int32 count)
       at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
       at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
       at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage)
       at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
       at Messenger.Web.Program.Main(String[] args)

网络配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
   <aspNetCore requestTimeout="02:00:00" 
     processPath="C:\Repository\publish\Messenger.Web.exe" 
     
     stdoutLogEnabled="true" 
     stdoutLogFile="C:\Repository\publish\logs\stdout" 
     forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>
<!--ProjectGuid: 30c02729-bd76-4a5f-9ed8-07828eb9edb3-->

1 个答案:

答案 0 :(得分:0)

您的日志中充满了异常 System.BadImageFormatException 。当我尝试在IIS上运行ASP.NET Core应用程序时遇到了相同的问题。显然,Web应用程序和Web服务器之间存在处理器类型不匹配。我通过在Visual Studio的“发布”设置中将“目标运行时”设置为“可移植”来解决此问题。您使用其他Web服务器,但是此异常始终具有相同的原因。您需要使所有dll文件都具有相同的位数,因为Web服务器会在进程内运行应用程序。

相关问题