2016-05-30 14 views
0

IISにASP.NET Core RC2 Appを公開しようとしています。 Iパッケージを作成するには、次のコマンドを使用していますよ:ASP.NET Core RC2 AppをIISに公開するSystem.Runtimeの問題

dotnet publish -f net451 -r win10-x64 -o C:\pub 

私はIISでアプリケーションを実行しようとすると、私は、ログファイルに次のエラーを得た:

Unhandled Exception: System.Reflection.TargetInvocationException: 
Exception has been thrown by the target of an invocation. ---> 
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, 
Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 
The system cannot find the file specified. 
at IoC.DepedencyConfiguration.AddMyAppServices(IServiceCollection services, IConfigurationRoot configuration) 
at MyApp.Web.Startup.ConfigureServices(IServiceCollection services) in C:\git\MyApp\src\Web\Startup.cs:line 52 
--- End of inner exception stack trace --- 
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) 
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) 
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
at Microsoft.AspNetCore.Hosting.Startup.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection exportServices) 
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() 
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() 
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() 
at MyApp.Web.Program.Main(String[] args) in C:\git\MyApp\src\Web\Program.cs:line 14 

同じエラーコマンドラインで実行可能ファイルを実行しようとすると発生します。

しかし、私はコマンドを使用して、そのコードのフォルダに直接アプリケーションを実行する場合:

dotnet run -f 451 

すべてが正常に実行されます。私はフレームワークをnet46に切り替えることも試みましたが、私は同じ動作をしました。私も"System.Runtime": "4.1.0-rc2-*"を参照しようとしましたが、どちらも助けになりませんでした。ここで

は私のproject.jsonです:

{ 
    "version": "1.0.0-*", 
    "userSecretsId": "aspnet5-MyApp-00000000-0000-0000-0000-000000000000", 

    "buildOptions": { 
    "emitEntryPoint": true, 
    "preserveCompilationContext": true 
    }, 

    "runtimeOptions": { 
    "gcServer": true 
    }, 

    "tools": { 
    "Microsoft.EntityFrameworkCore.Tools": { 
     "imports": ["portable-net451+win8"], 
     "version": "1.0.0-preview1-final" 
    } 
    }, 

    "dependencies": { 
    "Data.CrossCutting.Identity": "1.0.0-*", 
    "IoC": "1.0.0-*", 
    "Services.Contracts": "1.0.0-*", 
    "Services.HangFire": "1.0.0-*", 
    "Microsoft.EntityFrameworkCore.Tools": { 
     "version": "1.0.0-preview1-final", 
     "type": "build" 
    }, 
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Authentication.Facebook": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Authentication.Google": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Mvc.WebApiCompatShim": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Owin": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0-rc2-final", 
    "Microsoft.AspNetCore.Razor": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-rc2-final", 
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final", 
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final" 
    }, 

    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": [ 
     "dnxcore50", 
     "dotnet5.6", 
     "portable-net45+win8" 
     ], 
     "dependencies": { 
     "Microsoft.NETCore.App": { 
      "version": "1.0.0-rc2-3002702", 
      "type": "platform" 
     } 
     } 
    }, 
    "net451": { 
     "dependencies": { 
     "Hangfire": "1.5.3" 
     } 
    } 
    }, 

    "publishOptions": { 
    "include": [ 
     "wwwroot", 
     "Views", 
     "web.config", 
     "appsettings.json", 
     "appsettings.*.json" 
    ] 

    } 

} 
+0

"ツール":{ "Microsoft.AspNetCore.Server.IISIntegration.Tools":{ "バージョン": "1.0.0-preview1ファイナル"、 を「project.jsonに追加することによって、それを修正することができインポート ":"ポータブルnet45 + wp80 + win8 + wpa81 + dnxcore50" } }、 "スクリプト":{ "postpublish": "DOTNET公開-IIS --publishフォルダ%公開:OutputPath%--framework%公開:FullTargetFramework%" を } – ecsousa

+0

あなたのコメントを追加答えとして、それを解決策としてマークしてください:) –

答えて

0

の質問には申し訳ありませんが、私はproject.jsonに追加することで、ドキュメントのいくつかのより多くの読書の後にそれを修正することができました。私がいた

"tools": { 
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": { 
    "version": "1.0.0-preview1-final", 
    "imports": "portable-net45+wp80+win8+wpa81+dnxcore50" 
    } 
}, 
"scripts": { 
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" 
} 
関連する問題