Asp.net core .Net Framework+;核心模板应用程序部署到云Foundary
大家好,我正在使用.NET framework开发ASP.NET应用程序核心模板。我必须将我的应用程序发布到cloud foundry。但不幸的是,我的应用程序正在崩溃,无法部署到cloud foundry环境。任何人如果遇到同样的情况并解决了问题,请提出建议。谢谢。我已经通过一些网站,并试图修改如下仍然无法部署。我正在使用.NetCoreBuild包进行部署Asp.net core .Net Framework+;核心模板应用程序部署到云Foundary,asp.net-core,cloud-foundry,asp.net-core-webapi,Asp.net Core,Cloud Foundry,Asp.net Core Webapi,大家好,我正在使用.NET framework开发ASP.NET应用程序核心模板。我必须将我的应用程序发布到cloud foundry。但不幸的是,我的应用程序正在崩溃,无法部署到cloud foundry环境。任何人如果遇到同样的情况并解决了问题,请提出建议。谢谢。我已经通过一些网站,并试图修改如下仍然无法部署。我正在使用.NetCoreBuild包进行部署 Program.cs:- public static void Main(string[] args) {
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"
}
Program.cs:-
公共静态void Main(字符串[]args)
{
var config=new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var host=new WebHostBuilder()
.UseKestrel()
//.UseContentRoot(目录.GetCurrentDirectory())
//.Useii整合()
.UseConfiguration(配置)
.UseStartup()
.Build();
host.Run();
}
Project.Json:-
{
“构建选项”:{
“copyToOutput”:{
“包括”:[
“wwwroot”,
“***.cshtml”,
“appsettings.json”,
“web.config”
],
“排除”:[
“垃圾桶”,
“obj”
]
},
“调试类型”:“可移植”,
“emittentrypoint”:正确,
“保留编译上下文”:true
},
“出版选项”:{
“包括”:[
“wwwroot”,
“***.cshtml”,
“appsettings.json”,
“web.config”
],
“排除”:[
“垃圾桶”,
“obj”
]
},
“依赖项”:{
“Microsoft.AspNetCore.Server.Kestrel”:“1.0.2”,
“Microsoft.AspNetCore.Routing”:“1.0.2”,
“Microsoft.AspNetCore.Mvc”:“1.0.2”,
“Microsoft.AspNetCore.Razor.Tools”:{
“版本”:“1.0.0-preview4-final”,
“类型”:“生成”
},
“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”:{
“类型”:“平台”,
“版本”:“1.0.3”
},
“Microsoft.AspNetCore.Diagnostics”:“1.0.1”,
“Microsoft.VisualStudio.Web.BrowserLink.Loader”:“14.0.1”,
“Microsoft.AspNetCore.Server.IIS集成”:“1.0.0”,
“Microsoft.ApplicationInsights.AspNetCore”:“1.0.0”,
Microsoft.Extensions.Configuration:“1.1.0”
},
“框架”:{
“net461”:{}
},
“运行时选项”:{
“配置属性”:{
“System.GC.Server”:true
}
},
“脚本”:{
“预编译”:[“dotnet包”]
},
“工具”:{
“bundlermizier.Core”:“2.2.301”,
Microsoft.AspNetCore.Razor.Tools:“1.0.0-preview4-final”
},
“版本”:“1.0.3”
}
在project.json文件中指定:
"frameworks": {
"net461": { }
}
net461
引用了.NET Framework 4.6.1,但.NET Core构建包仅支持.NET Core。使用netcoreapp1.0
而不是net461
,如下所示:
"frameworks": {
"netcoreapp1.0": { }
}
感谢Daniel的回复,但我正在使用带核心模板的.Net framework。在这种情况下,请建议我应该使用哪个构建包。