2016-10-24 9 views
1

私は、ubuntu 14.04 vmで動作するdotnet core 1.0を手に入れました。私は私の展開プロセスのための成り上がりスクリプトを記述しようとしています:dotnet core on ubuntu 14.04 upstart issue

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. 
私は再びログを確認する https://portal.secret.com/をカールするとき

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; 
    } 

} 

しかし、私はの束を得る:自分のドメインとSSLのためのnginxのリバースプロキシで5000:

私は、ローカルホストを持っていますコンパイラエラー。

dotnetを稼働しているプロダクションフォルダから直接実行しているときにエラーが発生し、サイトにアクセスできることに注意してください。

ログ私が試してみて、サービスからサイトを実行している:

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..... 

誰もが、これは実行しているとき、私はサービスをupstartingしていないよ場合にのみ、起こっている理由として、任意の洞察力を持っています直接コマンド?

UPDATE:ここでは私の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" 
    } 
} 
+0

project.jsonを共有できますか? 'preserveCompilationContext'がセットされていますか? – svick

+0

応答ありがとうございます、はいこのビルドオプションはtrueに設定されています。 project.jsonの最新記事を参照してください。 – fredp613

答えて

0

はIで/ tmp/NuGetScratchフォルダを削除することでこれを解決しても、明示的に下のアプリを実行するユーザーのLinuxに語っています。更新されたサービスconfのスクリプトは次のとおりです。

start on filesystem and started networking 
respawn 
setuid dotnetuser 
env HOME=/home/dotnetuser 
exec rm -rf /tmp/NuGetScratch/ 
chdir /home/dotnetuser/apps/dotnetportal 
exec dotnet restore 
exec dotnet run 

問題は、.NETはので、私は削除ディレクトリ(TMP/NuGetScratch)で発見されnugetロックファイルによって引き起こされるファイルのアクセス許可の問題をコンパイルしていなかったということでした。あなたはrootとして実行することを期待しています - https://github.com/dotnet/dotnet-docker/issues/78(/ tmp/NuGetScratchはrootや他のsuによって所有されているため、NuGetキャッシュの作成に失敗します)