2016-11-27 13 views
4

私のデスクトップ上の私のアプリケーションのasp.netコアは正常に動作します。しかし、Windows Server 2007 R2に展開すると、このエラーが発生します。どんな助けでも感謝します。DLL 'api-ms-win-core-registry-l1-1-0.dll'を読み込むことができません

Application startup exception: System.DllNotFoundException: Unable to load DLL 'api-ms-win-core-registry-l1-1-0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
    at Interop.mincore.RegOpenKeyEx(SafeRegistryHandle hKey, String lpSubKey, Int32 ulOptions, Int32 samDesired, SafeRegistryHandle& hkResult) 
    at Microsoft.Win32.RegistryKey.InternalOpenSubKeyCore(String name, RegistryRights rights, Boolean throwOnPermissionFailure) 
    at Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver.ResolveDefaultPolicy() 
    at Microsoft.Extensions.DependencyInjection.DataProtectionServices.<GetDefaultServices>d__0.MoveNext() 
    at Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(IServiceCollection collection, IEnumerable`1 descriptors) 
    at Microsoft.Extensions.DependencyInjection.DataProtectionServiceCollectionExtensions.AddDataProtection(IServiceCollection services) 
    at Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions.AddAuthentication(IServiceCollection services) 
    at Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionExtensions.AddIdentity[TUser,TRole](IServiceCollection services, Action`1 setupAction) 
    at Safety.Startup.ConfigureServices(IServiceCollection services) 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) 
    at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() 
    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() 
Hosting environment: Production 
Content root path: C:\inetpub\wwwroot\website.com\httpdocs 
Now listening on: http://localhost:16695 
Application started. Press Ctrl+C to shut down. 

答えて

1

私は同じ質問と問題がありました。私のエラーの原因は、Windows 10で開発し、Window 2008 R2に展開することでした。

解決方法は、project.jsonのランタイムをwin7-x64に編集することです。オリジナル

:固定

"runtimes": { 
    "win10-x64": {} 
    }, 

"runtimes": { 
    "win7-x64": {} 
    }, 

私は両方のランタイムを持ってしようとするが、私の失敗していまし公開しました。

あなたの "ターゲットランタイムは、" 設定を公開していることを確認してくださいは、Win7のx64の-に設定されています:

Visual Studio Publish Setting

+0

は、変更を行った後、 'DOTNETのrestore'を実行する必要があります。そうでなければ、 ":Assetsファイル 'C:\ Spartan \ Spartan_KPI_Updater \ obj \ project.assets.json'に '.NETCoreApp、Version = v1.1/win7-x64'のターゲットがありません。 TargetFramework = 'netcoreapp1.1'のプロジェクト "ありがとう! –

関連する問題