簡體   English   中英

如何修復“無法加載共享庫'httpapi.dll'或其依賴項之一”

[英]How to fix “Unable to load shared library 'httpapi.dll' or one of its dependencies”

我是linux的新手。 但是我需要在此操作系統上運行asp net core應用程序。 我在Windows 10中成功構建和編譯應用程序,但是當我將其移至linux並嘗試運行時出現以下異常

Application startup exception: System.TypeInitializationException: The type initializer for 'Microsoft.AspNetCore.Server.HttpSys.HttpApi' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'httpapi.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libhttpapi.dll: cannot open shared object file: No such file or directory
   at Microsoft.AspNetCore.Server.HttpSys.HttpApi.HttpInitialize(HTTPAPI_VERSION version, UInt32 flags, Void* pReserved)   at Microsoft.AspNetCore.Server.HttpSys.HttpApi.InitHttpApi(UInt16 majorVersion, UInt16 minorVersion)
   at Microsoft.AspNetCore.Server.HttpSys.HttpApi..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.HttpSys.HttpSysListener..ctor(HttpSysOptions options, ILoggerFactory loggerFactory)
   at Microsoft.AspNetCore.Server.HttpSys.MessagePump..ctor(IOptions`1 options, ILoggerFactory loggerFactory, IAuthenticationSchemeProvider authentication)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

而且我確實需要使用httpSys驅動程序。 那是我的代碼

 public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .UseHttpSys();

您不能在Linux上運行Http.sys,它是Windows托管選項。請參閱文檔

Http.sys與Windows(以及IIS,即Microsoft Web服務器)緊密耦合。

對於Linux,您必須使用Kestrel。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM