Problem with ASP.NET MVC application deployment

I’m currently deploying my ASP.NET MVC5 project. I already deployed project files, but I got some problems with, I guess, the database. I did the following steps to deploy the database:

  1. Update-database -script in Visual Studio to get the SQL script of my local database (I developed it by code-first)
  2. Connect to the SQL Server database I created in my hosting panel.
  3. Run the script I generated in 1.
  4. Change the connection string in my web.config to this:
         <add name="DefaultConnection"
              connectionString="Data Source=xxxxxx.xxxwebix.xx,2401;Initial Catalog=xxxxx;User ID=xxxxx;Password=xxxxx"
              providerName=".NET Framework Data Provider for SQL Server"
              xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>   

So basically I filled it in with the same credentials I had used to connect to the DB to run the script.

Unfortunately, I’m unable to register or login. I get an error

An error occurred while processing your request.
500 (Internal Server Error)

in the console, which doesn’t exactly say what’s wrong. So basically, I know that the problem probably concerns the database, but I don’t know what’s wrong and how to get rid of it. This is my website (maybe it will help somehow):

I’d be thankful for any help.

I found the problem – providerName. That’s weird because I took it from the database properties after I connected to it in Visual Studio. I changed it to default “System.Data.SqlClient” and it worked. Does someone knows why?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

There are a lot of things that could be going on here. The fact it is throwing a 500 error means either some code is causing a major error and/or you do not have friendly errors turned on.

There are some things you can do to figure out exactly where the issue is. In your console, make sure friendly errors are turned on, and you should get a bit more information. You can also add try … catches to where you think the issue is and avoid the exception and write a message instead (this is fairly crude, but quick and easy). Turning on tracing can also work, as long as you can actually spin up the application without the 500. You add trace statements before and after each routine and then go an examine the trace file. The same can be done, in more crude fashion, by writing to a file. The use of this method is you can turn trace on and off at will.

The fact you used code first is non-important if you are creating a SQL Script the correct way. When you run it, as long as it works (creates and possibly seeds?), you have the correct schema.

So, does the app throw the error up front or only when accessing data? If the latter, you have a good place to start seeking out errors.

BTW, you may be able to test locally against your providers database by changing your local connection strings. It will depend on having certain ports open, which you might even be able to do if they are not for security reasons. You can then debug the exception locally.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x