添加.sln时.NET Core 2.1应用程序失败 [英] .NET Core 2.1 App Fails when .sln Added

查看:91
本文介绍了添加.sln时.NET Core 2.1应用程序失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常通用的.NET Core 2.1应用程序,已成功将其部署到Linux应用程序服务中.它只是在根文件中有一个.csproj,而没有.sln或类似的东西.我的启动文件在Azure的应用程序设置"部分中留为空白.

I had a pretty generic .NET Core 2.1 app that I have been successfully deploying to a Linux App Service. It simply had a .csproj in the root file, no .sln or anything like that. My startup file was left blank in the App Settings section of Azure.

今天,我在应用程序中添加了nUnit项目,因此我决定添加.sln文件,然后将.csproj和所有周围的文件移动到子目录中.所以基本上我的目录结构是

Today I added nUnit project to the app, so I decided add a .sln file, and move the .csproj and all of the surrounding files to a subdirectory. So basically my directory structure is

-根
  -服务器
    -Server.csproj
    -其他文件
  -测试
     -Tests.csproj
     -测试文件

- Root
  - Server
    - Server.csproj
    - Other files
  - Tests
     - Tests.csproj
     - Test Files

现在,当我部署到Azure(使用GitHub部署)时,它失败,并显示一条日志,上面写着对象引用未设置为对象的实例"

Now when I deploy to Azure (using GitHub deployment) it fails with a log that simply says "Object reference not set to an instance of an object"

我不知道该错误发生在哪里.我知道我已经移动了我的主.dll,但从未指定该位置.我在哪里做?

I don't know where this error is occurring though. I understand that I moved my main .dll, but I never specified where that was. Where do I do that at? Where is that error even happening?

推荐答案

Just to highlight, yes, to get automatic builds from the App Service Kudu build server, you need to make sure that your repository root has the correct files in your project.

所有受官方支持的部署方法都有共有的一件事:他们更改/site/home/wwwroot 文件夹中的文件 您的应用程序.这些是在生产环境中运行的相同文件.因此,部署可能由于文件锁定而失败,或者生产中的应用程序在部署期间可能具有不可预知的行为,因为并非同时更新所有文件.

All the officially supported deployment methods have one thing in common: they make changes to the files in the /site/home/wwwroot folder of your app. These are the same files that are run in production. Therefore, the deployment can fail due to locked files, or the app in production may have unpredictable behavior during deployment because not all the files are updated simultaneously.

 

要进一步缩小问题的范围,您可以从整个存储库中删除.sln文件,这将导致构建成功,应用程序 将部署.或者,您可以包括 自定义部署脚本 并在您的代码中添加一个 .deployment  文件到该项目的 根目录并在其中指定部署脚本.

To narrow down the issue further, you can either remove the .sln file from the whole repository, which will result in the build to succeed, the application will deploy. Or you can include a custom deployment script with your code by adding a .deployment file into the project’s root and specifying the deployment script in it.

 

此外,请查看以下步骤中概述的步骤文件 对Azure应用服务上的ASP.NET Core进行故障排除 -本文提供了有关如何使用Azure应用服务的诊断来诊断ASP.NET Core应用启动问题的说明工具.

Additionally, checkout the steps outlined in the document Troubleshoot ASP.NET Core on Azure App Service - This article provides instructions on how to diagnose an ASP.NET Core app startup issue using Azure App Service's diagnostic tools. 

 

检出文档 在Azure App Service上托管ASP.NET Core 了解更多详细信息.

Checkout the document Host ASP.NET Core on Azure App Service for more details.

------ -------------------------------------------------- -------------------------------------------------- ------

如果此答案有帮助,请单击标记为答案"和投票.要提供有关您的论坛体验的其他反馈,请单击 >

If this answer was helpful, click "Mark as Answer" and Up-Vote. To provide additional feedback on your forum experience, click here


这篇关于添加.sln时.NET Core 2.1应用程序失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆