This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23005|Reply: 0

[.NET Core] CentOS 7 runs the .NET Core website error solution

[Copy link]
Posted on 6/27/2018 11:01:59 PM | | | |
Error:
  An assembly specified in the application dependencies manifest (WebApplication1.deps.json) was not found:
    package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.3'
    path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll'



Above is an error that ASP.Net Core application cannot report on centos 7

Solution 1 (Failed)

Because only the installed . Net Core runtime without installing ASP.NET Core runtime. Official website link:The hyperlink login is visible.



Try running a command like this:



Then, try restarting the .NET program, but the error is still as above.

Solution 2 (Done)

The problem is that asp.net doesn't release all the packages that the server needs, it thinks the target system has it, but in fact the target system doesn't. Solution:

Add the following line to the csjproj file, as shown in the figure below:






Package and upload to our server, restart the application, and find that it starts normally, as shown in the figure below:

[root@VM_0_9_centos project]# dotnet WebApplication1.dll
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {03f25bc0-bd97-441f-a013-72fbe8537c95} may be persisted to storage in unencrypted form.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Error -99 EADDRNOTAVAIL address not available'.
Hosting environment: Production
Content root path: /root/project
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.




Interface code:




We find that we cannot access normally through the external IP and 5000 ports, we need to install nginx, get a reverse proxy, nginx I have installed, the installation tutorial about nginx is as follows:
Centos installation nginx-1.14.0 tutorial
https://www.itsvse.com/thread-4855-1-1.html
(Source: Architect_Programmer)


nginx.conf is configured as follows:

At this time, we access it through the external IP and port 80, and found that it can be accessed normally! As shown below:








Previous:ionic Common Error Summary
Next:Create an MVC project ASP.NET the Core command line
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com