[英]Getting HTTP ERROR 404 after publishing ASP.NET application in Azure App Service with Visual Studio 2017
I have an application in ASP.NET Framework 4.6.1 that works fine when running in my local environnent using Visual Studio 2017 (version 15.7.27703.2035). 我在ASP.NET Framework 4.6.1中有一个应用程序,使用Visual Studio 2017(版本15.7.27703.2035)在我的本地环境中运行时可以正常工作。
On server side, the same application is displaying an HTTP ERROR 404. 在服务器端,同一应用程序正在显示HTTP ERROR 404。
Screenshot on local environment 本地环境截图
Screenshot on server environment 服务器环境截图
To publish the ASP.NET application, I am using the publish tool of Visual Studio and deploy everything on an App Service of Azure. 要发布ASP.NET应用程序,我使用Visual Studio的发布工具并在Azure的App Service上部署所有内容。
Visual studio publish tool and project architecture Visual Studio发布工具和项目架构
I tried to use FTP deployment instead of Web Deploy with no success. 我尝试使用FTP部署而不是Web部署,但没有成功。 I also tried manualy with FileZilla with no success.
我也尝试过使用FileZilla但没有成功。
Is it possible that some sort of action is needed when publishing a project with custom libraries? 使用自定义库发布项目时是否可能需要某种操作?
EDIT 编辑
What I know: 我知道的:
dlls on server side I actualy have access to the wwwroot folder on server side: this mean I can access js, css, images, etc. But it seems that controllers, views and others folders don't exist on the server..
在服务器端dll我实际上可以访问服务器端的wwwroot文件夹:这意味着我可以访问js,css,图像等。但似乎服务器上不存在控制器,视图和其他文件夹..
Libraries issus?
图书馆的问题? The problem appeared when I subdivided my project with the customs libraries CrmDatabaseManager, SysaidDatabaseManager and UserInterfaceLibrary.
当我使用海关库CrmDatabaseManager,SysaidDatabaseManager和UserInterfaceLibrary细分我的项目时出现问题。
wwwroot inside wwwroot on server side A wwwroot folder include anoter wwwroot folder on the server;
wwwroot在服务器端的wwwroot wwwroot文件夹包括服务器上的anoter wwwroot文件夹; the first wwwroot folder contains all dlls, and inside it, there is another wwwroot folder containing css, js, images and etc, but no sign of controllers or views.
第一个wwwroot文件夹包含所有dll,在其中,还有另一个包含css,js,images等的wwwroot文件夹,但没有控制器或视图的标志。
How I created the project I created the project GPRH this way using ASP.NET Core 2.0 based on .NET Framework
我如何创建项目我使用基于.NET Framework的ASP.NET Core 2.0以这种方式创建了项目GPRH
It turns out that split the project with libraries did broke path references. 事实证明,用库拆分项目确实破坏了路径引用。
I was hard coding the path and there were no problems with that into the main project. 我很难对这条路进行编码,并且在主项目中没有任何问题。 When I splited the project with libraries, it caused an error 404.
当我用库分割项目时,它导致错误404。
To access a file in a libary, you need to do this manipulation first: 要访问库中的文件,首先需要执行此操作:
Then specifie the path this way on the library: 然后在库中以这种方式指定路径:
var buildDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var filePath = buildDir + @"\fileName.json";
using (StreamReader r = new StreamReader(filePath))
{
// code here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.