0

I made ASP.NET MVC web application and uploaded it to GoDaddy. Whenever I change the connection string in the web.config to data source=[Server IP];initial catalog=[Database Name];user id=[Username];password=[Password];, I get this error

500 - Internal server error.

If I made it like this data source=[Server IP];initial catalog=[Database Name];integrated security=true; , I get the following error -which is expected since the database is on a different server than the web application-

Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

So, it seems that the problem is somehow related to the integrated security part. Also it's working without issues on my local machine, and I cann connect to the database server using the same credentials I use in the web.config file.

How can I solve this issue?

Ahmed
  • 511
  • 3
  • 6
  • 26
  • 1
    The second error indicates that Windows authentication won't work. Most likely you won't be able to use Windows authentication with GoDaddy. The first error indicates the problem is somewhere else. Since you didn't get a database related error, it probably means that your connection string is okay in that case. But, you have another configuration problem with the application or web server you need to find. In other words, put the first connection string in and then try to get more detailed information about the first error. – NightOwl888 May 29 '16 at 21:48

1 Answers1

1

I figured it out at last.

Firstly I added this line to web.config file in an attempt to see a detailed error message

<system.webServer>
   <httpErrors errorMode="Detailed"/>
   ...
</system.webServer>

But I got the same error again.

500 - Internal server error.

In this stage, I was quite sure that the error is within the web.config, and not something else.

After focusing on revising the file and consulting aquentenance of mine, it turned out that the error was in the connection string at the database password!!!!

What happened is that I generated a random password for the database using GoDaddy, and it was something like this q59M&aw8. As you know & is an illegal character in XML, so it corrupted the whole file.

The solution is to either escape it like so & => &amp;, or avoid using illegal characters as passwords.

Community
  • 1
  • 1
Ahmed
  • 511
  • 3
  • 6
  • 26