Click here to Skip to main content
15,506,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have newly created an MVC.NET application using the template in Visual Studio 2019. This runs fine in my local IIS (built into VS) but when I deploy to my live server, I get a couple of 500 errors.

The offending files are an image that I have placed in the \Content directory and favicon.ico in the root of the website.

I followed the advice in the first answer on this SO page (c# - How to publish ASP.NET MVC site with File Zilla using FTP - Stack Overflow[^]). This advised publishing to a local folder and then FTP-ing everything in there up to the live server. Unfortunately, I still get the error.

As you can probably guess, I am new to MVC.NET, so any advice would be most welcome.

- Patrick

What I have tried:

I have checked and both files - \favicon.ico and \Content\MyImage.jpg - are being copied as part of the local publish and are then correctly transferred to the live site via FTP.

I have also viewed the source for the live page and this appears to be correct:

<img src="/Content/MyImage.jpg">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
Updated 14-Jun-21 21:42pm
F-ES Sitecore 18-Feb-21 9:46am    
What are the 500 errors you're getting? A missing icon or image won't create 500 errors.
Patrick Skelton 19-Feb-21 2:40am    
I'm just getting the general 500 error 'Internal Server Error'. Thing is the files are not missing. I've checked and treble-checked that they are in the same place as the HTML reference, and since these are all relative to site-root, I really don't see how the files can cause a problem.

1 solution

It seems the answer to this is extremely simple. Publish to a local folder on your machine and then use FTP to put the contents of this folder on the web server.

I have an excellent program called SyncBackSE which will watch a directory for changes and do the second step automatically. Thus I end up with a one-step deployment.

As a plus, I get a local copy of a deployment on a given day which is dead easy to back-up, for belt-'n'-braces safety.

This idea was given to me in the following post and this does work despite the unrelated problems I was having in my original question above: c# - How to publish ASP.NET MVC site with File Zilla using FTP - Stack Overflow[^] )

Hope this helps someone.

- Patrick
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900