我开始在Google Cloud上使用App Engine。我从Google下载了示例应用并运行它,它运行正常。当我在.Net Core Razor Pages中在VS2017中创建一个新项目时。我在计算机上运行它没有任何问题。但是,当我将其部署到云时,它失败了。我从两个访问日志。第一个日志来自示例应用程序。第二个日志是我自己的项目。我没有在日志中看到任何错误或任何不同。我错过了什么吗?
{
httpRequest: {
latency: "0.135s"
referer: "-"
remoteIp: "2607:fcc8:608c:3a00:de8:d13b:5871:2a5"
requestMethod: "GET"
requestUrl: "/"
responseSize: "22"
status: 200
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
}
insertId: "1uvem8cg1szzlpp"
jsonPayload: {
appLatencySeconds: "0.135"
httpRequest: {
protocol: "HTTP/1.1"
}
latencySeconds: "0.135"
trace: "8f73f754de13f45c2a52f96d68fa0aea"
}
labels: {
appengine.googleapis.com/instance_name: ""
appengine.googleapis.com/trace_id: "8f73f754de13f45c2a52f96d68fa0aea"
compute.googleapis.com/resource_id: "1319068021706788373"
compute.googleapis.com/resource_name: "b083e85685ef"
compute.googleapis.com/zone: "us-east4-c"
}
logName: "projects/psa-199021/logs/appengine.googleapis.com%2Fnginx.request"
receiveTimestamp: "2018-04-04T11:07:35.003592385Z"
resource: {
labels: {
module_id: "default"
project_id: "psa-199021"
version_id: "20180404t070131"
}
type: "gae_app"
}
timestamp: "2018-04-04T11:07:29.814Z"
}
失败的项目的第二个日志
{
httpRequest: {
latency: "0.003s"
referer: "https://psa-199021.appspot.com/"
remoteIp: "2607:fcc8:608c:3a00:de8:d13b:5871:2a5"
requestMethod: "GET"
requestUrl: "/favicon.ico"
responseSize: "22"
status: 200
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
}
insertId: "1uvem8cg1szzlpq"
jsonPayload: {
appLatencySeconds: "0.003"
httpRequest: {
protocol: "HTTP/1.1"
}
latencySeconds: "0.003"
trace: "1db22573c8896fb23beff41088c79e14"
}
labels: {
appengine.googleapis.com/instance_name: ""
appengine.googleapis.com/trace_id: "1db22573c8896fb23beff41088c79e14"
compute.googleapis.com/resource_id: "1319068021706788373"
compute.googleapis.com/resource_name: "b083e85685ef"
compute.googleapis.com/zone: "us-east4-c"
}
logName: "projects/psa-199021/logs/appengine.googleapis.com%2Fnginx.request"
receiveTimestamp: "2018-04-04T11:07:35.003592385Z"
resource: {
labels: {
module_id: "default"
project_id: "psa-199021"
version_id: "20180404t070131"
}
type: "gae_app"
}
timestamp: "2018-04-04T11:07:30.223Z"
}
答案 0 :(得分:4)
<强>更新强>
截至2018年4月10日,Google Cloud App Engine .Net Core运行时支持.Net Core 2.0.6。
原始回答 此问题可能是由于使用MS VS 2017模板创建的te项目使用的.Net Core版本与我们当前在App Engine中支持的.Net Core版本不匹配。您可以跟踪问题here。
我可以提供两种临时解决方案:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>