美好的一天所有,我正在使用.Net框架开发ASP.NET应用程序核心模板。我必须将我的应用程序发布到云代工厂。但不幸的是我的应用程序崩溃并且无法部署到云代工环境。如果遇到相同的情况并且解决了问题,请建议任何人。谢谢。我已经浏览了一些网站并尝试修改如下仍然无法部署。我正在使用.NetCoreBuild包进行部署。
Program.cs:-
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.UseKestrel()
//.UseContentRoot(Directory.GetCurrentDirectory())
//.UseIISIntegration()
.UseConfiguration(config)
.UseStartup<Startup>()
.Build();
host.Run();
}
Project.Json:-
{
"buildOptions": {
"copyToOutput": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
],
"exclude": [
"bin",
"obj"
]
},
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
],
"exclude": [
"bin",
"obj"
]
},
"dependencies": {
"Microsoft.AspNetCore.Server.Kestrel": "1.0.2",
"Microsoft.AspNetCore.Routing": "1.0.2",
"Microsoft.AspNetCore.Mvc": "1.0.2",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview4-final",
"type": "build"
},
"Microsoft.AspNetCore.StaticFiles": "1.0.1",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.1",
"Microsoft.Extensions.Configuration.Json": "1.0.1",
"Microsoft.Extensions.Logging": "1.0.1",
"Microsoft.Extensions.Logging.Console": "1.0.1",
"Microsoft.Extensions.Logging.Debug": "1.0.1",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.3"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.1",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.Extensions.Configuration": "1.1.0"
},
"frameworks": {
"net461": { }
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"scripts": {
"precompile": [ "dotnet bundle" ]
},
"tools": {
"BundlerMinifier.Core": "2.2.301",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview4-final"
},
"version": "1.0.3"
}
答案 0 :(得分:1)
在project.json文件中,您需要指定:
"frameworks": {
"net461": { }
}
net461
指的是.NET Framework 4.6.1,但.NET Core buildpack仅支持.NET Core。使用netcoreapp1.0
代替net461
,如下所示:
"frameworks": {
"netcoreapp1.0": { }
}