ubuntu 14.04 vm で dotnet core 1.0 を実行しています。展開プロセス用の upstart スクリプトを作成しようとしています。
start on filesystem and started networking
respawn
chdir /home/dotnetuser/dotnetportal/
exec sudo /usr/bin/dotnet restore
exec sudo /usr/bin/dotnet run
このサービスを実行した後、ログを確認し、通常予想されるものを取得します (ローカルでのテスト/開発 VM から):
Hosting environment: Production
Content root path: /home/dotnetuser/dotnetportal
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
ドメインと ssl の nginx リバース プロキシに localhost:5000 があります。
server {
# Enable HTTP/2
listen 443 ssl; #http2;
listen [::]:443 ssl; #http2;
server_name portal.secret.com;
# use the lets encrypt certificates
ssl_certificate /etc/letsencrypt/live/portal.secret.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/portal.secret.com/privkey.pem;
# include the SSL configuration from cipherli.st
include snippets/ssl_params.conf;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
ただし、 https://portal.secret.com/をカールすると、ログを再度確認すると、多くのコンパイラ エラーが発生します。
作業中の運用フォルダーから dotnet run を直接実行してもエラーは発生せず、サイトにアクセスできることに注意してください。
サービスからサイトを実行しようとしたときのログは次のとおりです。
an unhandled exception has occurred: Can not find compilation library location for package ' microsoft.aspnetcore.antiforgery'
18 System.InvalidOperationException: Can not find compilation library location for package 'microsoft .aspnetcore.antiforgery'
19 at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
20 at System.Linq.Enumerable.<SelectManyIterator>d__157`2.MoveNext()
21 at Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature( IEnumerable`1 parts, MetadataReferenceFeature feature ETC.....
コマンドを直接実行しているときではなく、サービスを起動しているときにのみこれが発生する理由について、誰かが洞察を持っていますか?
更新: ここに私の Project.json があります
{
"userSecretsId": "xxxxx",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"System.Runtime.Loader": "4.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-update1",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-update1",
"type": "build"
},
"MongoDB.Driver" : "2.3.0"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "WebApplication"
}
}