2016-10-01 7 views
0

ASP.NETコアプロジェクトはnet461をターゲットにしてAzure Webサイトで実行できますか?Azureでnet461をターゲットとするASP.NETコア


これは試行錯誤したものです。

netcoreapp1.0をターゲットとする場合それは動作しますが、私は(コンパイルするためにいくつかの他の必要な変更を含む)net461に変更したときに、私は次のエラーを取得する:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Extensions.PlatformAbstractions.PlatformServices' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 
    at Microsoft.Extensions.PlatformAbstractions.ApplicationEnvironment.GetApplicationBasePath() 
    at Microsoft.Extensions.PlatformAbstractions.ApplicationEnvironment..ctor() 
    at Microsoft.Extensions.PlatformAbstractions.PlatformServices..ctor() 
    at Microsoft.Extensions.PlatformAbstractions.PlatformServices..cctor() 
    --- End of inner exception stack trace --- 
    at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildHostingServices() 
    at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() 
    at WebApplication1.Program.Main(String[] args) in C:\Users\a\WebApplication1\Program.cs:line 14 

具体的

System.IO.FileNotFoundException: Could not load file or assembly 'System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

ローカルそれが正常に動作します。

私は必要なアセンブリを組み込むためにnaugetパッケージを追加しました。

warn: Microsoft.AspNetCore.Server.Kestrel[0] 
     Unable to bind to http://localhost:7762 on the IPv6 loopback interface. 
System.AggregateException: One or more errors occurred. ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4089 EAFNOSUPPORT address family not supported 
    at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.Check(Int32 statusCode) 
    at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags) 
    at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress address) 
    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListener.CreateListenSocket() 
    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<>c.<StartAsync>b__6_0(Object state) 
    --- End of inner exception stack trace --- 

私はどこここから行くのか分からない:

{ 
    "dependencies": { 
    "Microsoft.AspNetCore.Diagnostics": "1.0.0", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", 
    "Microsoft.AspNetCore.StaticFiles": "1.0.0", 
    "Microsoft.Extensions.Logging.Console": "1.0.0", 
    "Newtonsoft.Json": "9.0.1", 
    "System.AppContext": "4.1.0", 
    "System.Reflection.TypeExtensions": "4.1.0", 
    "System.Security.Cryptography.X509Certificates": "4.1.0" 
    }, 

は最終的に私はエラーの異なる種類を得ました。

答えて

2

パブリッシュプロファイルには、[追加先のファイルを削除する]チェックボックスがオンになっていましたが、まだいくつかのファイルが残っている必要があります。

公開する前に、FTPを使用して手動ですべてのファイルを削除して、プロジェクトを解決してください。

ASP.NETコアターゲティングnet461は以前に他のフレームワークを公開していないと仮定してAzureで動作します。

私が質問で追加したこれらのNuGetパッケージは、どちらも必要ではなく、プロジェクトから安全に削除することができます。さておき、あなたはまた、管理/あなたのファイルを表示するにはFTPよりも便利である、[クーズーコンソール](https://github.com/projectkudu/kudu/wiki/Kudu-console)を使用することができるよう

"System.AppContext": "4.1.0", 
"System.Reflection.TypeExtensions": "4.1.0", 
"System.Security.Cryptography.X509Certificates": "4.1.0" 
+2

。 –

関連する問題