2016-10-01 5 views
0

ASP.NET 코어 프로젝트가 net461을 대상으로하고 Azure 웹 사이트에서 실행할 수 있습니까?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.

는 로컬 그것을 잘 작동합니다 .

나는 필요한 어셈블리를 포함하도록 순진하게 누 그 패키지를 추가했습니다.

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는 볼보다 더 편리 여담으로

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

, 당신은 또한 사용할 수 있습니다 [쿠두 콘솔] (https://github.com/projectkudu/kudu/wiki/Kudu-console)/파일을 관리 . –