500 Internal Server Error When Trying To Run An ASP.NET Core Project Copied From One Machine To Another Machine

ASP.NET Core

0 ( 0 votes) | 1694

In this article, we will discuss about an error when we try to run an ASP.NET Core project copied from one machine to another machine.

Error:

I have created an ASP.NET Core project using the project template in Visual Studio 2015. It was working properly on my laptop. Then i copied that same solution from my laptop to desktop machine and tried to run the project. When i tried to run the project, i was getting 500 Internal Server Error as shown below (F: 1). But the same solution was working properly on my laptop.

500 Internal Server Error

Analysis of Error Message:

When i copied the solution folder from my laptop to desktop machine, a hidden folder .vs was also got copied. When i looked at the error message closely, i found that it was displaying the config file location as the location of that file on my laptop as shown below (F: 2).

Config File Location In Error Message

Solution:

There are two solutions to fix this issue.

  1. Close the solution and reopen it again in Visual Studio 2015 on new machine.
  2. Change the physical path for solution in applicationhost.config file.

First solution is very easy. For second solution first we need to close Visual Studio 2015. To change the physical path for the solution in applicationhost.config file, open up the applicationhost.config file located under .vs/config folder of copied solution and search for term “sites”. It is a XML file.

Under sites node locate the site node where physical path for the solution is specified and binding information contains the same port number as your application is trying to run on as shown below.

 
                
                    
                
                
                    
                

Then I just change the physical path value to the actual physcial path of the solution on my desktop machine. Then everything started to work.

First solution is also similar to second solution because when we reopen the project in Visual Studio 2015, Visual Studio will change the solution path in applicationhost.config file according to the new physical path of the solution on new machine. But if it doesn’t work then, we need to follow the second solution and change that path manually.

Conclusion:

In this article, we talked about how to resolve the 500 Internal Server Error issue when trying to run an ASP.NET Core project copied from one machine to another machine. I hope you enjoyed reading the article.

Happy Coding and Wish You A Happy New Year!

Manoj Kulkarni - Dotnetcontext

Manoj Kulkarni

I am programmer, passionate blogger and foodie. I live in Nashik. I am a .Net developer. I like to learn new technologies to keep my self-updated and share that knowledge with my blog readers, friends and colleague.

2 Comments


Rubin - Dotnetcontext

RubinThursday, February 23, 2017 2:49 AM

Hi there! Someone in my Myspace group shared this website with us so I came to check it out. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Terrific blog and fantastic design and style.

Manoj Kulkarni - Dotnetcontext

Manoj KulkarniThursday, February 23, 2017 2:50 AM

Thank you for the feedback Rubin

Add a new comment