新しい .NET サポートを使用して Linux マシンをセットアップしました。
- このチュートリアルの使用: http://docs.asp.net/en/latest/getting-started/installing-on-linux.html
このdockerfileを持っている:
FROM microsoft/aspnet:1.0.0-beta5 # Copy the project into folder and then restore packages COPY . app WORKDIR app RUN ["dnu","restore"] # Open this port in the container EXPOSE 5000 # Start application ENTRYPOINT ["dnx",".", "web"]
走行
docker build .
成功です実行する
# docker run -p 8080:5000 dockerfile
と、次の例外が発生します。System.InvalidOperationException: No service for type 'Microsoft.Framework.Runtime.IApplicationEnvironment' has been registered. at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService (IServiceProvider provider, System.Type serviceType) [0x00000] in <filename unknown>:0 at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService[IApplicationEnvironment] (IServiceProvider provider) [0x00000] in <filename unknown>:0 at Microsoft.AspNet.Hosting.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0 at Microsoft.Dnx.ApplicationHost.Program+<>c__DisplayClass3_0.<ExecuteMain>b__0() [0x00000] in <filename unknown>:0 at System.Threading.Tasks.Task`1[System.Threading.Tasks.Task`1[System.Int32]].InnerInvoke() [0x00000] in <filename unknown>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <filename unknown>:0
ここに私の完全なビルドログがあります
ここで何が間違っていますか?Windowsで同じプロジェクトを実行するとdnx . web
、webapiが正常に起動します。