I am running an ASP website and connect to a SQL database, very standard setup. The connection string details are held in the <connectionStrings> tag of the web.config file.
If the database username/password details are not correct, I get an YSOD unhandled exception notice. This is not at all surprising, but I would like to show a custom error page instead. However, I cannot seem to get the custom page to show using <customErrors> settings.
It seems an unhandled exception at the web.config level (for example the incorrect database connection string) means the application does not get as far as redirecting to the custom error page.
Any advice on how to handle this exception would be much appreciated. I understand if the exception happened on a particular page I can add a try/catch to catch it. I am not sure where/how I can handle this exception:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user xxxxx
Find place where this connection string is used and handle exception there.
Related
I'm new on this website and I'm stuck with a server error. I tried everything and i just cant figure it out. I'm also new to asp.net mvc so I'm stil a noob.
I just got a feeling that there is something going on in my web.config.
So the error is that if you go to a certain detail page, you go to the error page that the previous programmer made and that error says: "internal server error"
I deleted that to see the original error message:
Server Error in '/' Application.
Runtime Error Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
The weird thing is that on my localhost it does work, its just the online website that has the error.
I'm just stuck at this point and need help :(
I don't know what most of the code means in the web.config but I don't want to leak something important so I'm kinda scared to post all the code, there are like publickeytokens and some other stuff
I'm attempting to connect my database to my ASP.NET MVC application but every time I start the application, I get an error saying that my password is incorrect which is impossible. Please let me know if you can see any mistake I've made in my code.
web.config file
Error
The first error it shows is:
System.Data.Entity.Core.ProviderIncompatibleException:
'An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file.
See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
And the second
PostgresException: 28P01: password authentication failed for user "u173082"
I think your property for the User Id is incorrect. I pulled a functional connection string, which looks like this:
Host=<>;Username=<>;Password=<>;Database=postgres;Port=5432
So, where you have "User Id" in your connection string, try using "Username."
I am logging the connection status events with the wcf relay, and I'm seeing something like this in the logs.
1/26 06:47:12 ERROR Service Bus ConnectionStatus: 'Reconnecting' Event. [(null)][42]
LastError: System.ServiceModel.CommunicationException: Exception of type 'System.ServiceModel.CommunicationException' was thrown. ---> Microsoft.ServiceBus.Messaging.Amqp.AmqpException: An AMQP error occurred (condition='amqp:unauthorized-access').
--- End of inner exception stack trace ---
This exception doesn't show up in the list on this microsoft page, and the only other post I can find anywhere related to this error message is here. However, that post does not have any recent comments or a resolution or workaround for the issue. Also, the exception doesn't have any stacktrace, so how am I supposed to troubleshoot this error?
I guess as a follow-up, I would ask whether this is anything to actually worry about if the wcf connection is never faulting.
Apparently, the token that the relay keeps refreshing to stay active requires the time on the server to match the azure service that it is connecting with, and if not, this type of error will show up. We were able to fix it by correcting the server time.
String or binary data would be truncated.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated.
I am getting this exception even after I did undo changes for the page, please someone help me to come out of this. *
You are trying to insert a data (string or binary) longer than the maximum length possible for the target field.
I agree with Morix Dev, your columndefintion is too small.
The exception dosnt report which column is too small. But you could log out the data before insert, and check them against the definition.
I have a asp.net MVC 4 that earlier works fine. Now when I run it I got error like
A non-recoverable error occurred during a database lookup
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: A non-recoverable error occurred during a database lookup
Source Error:
Line 291: using (MySqlConnection cnn = new MySqlConnection(Globals.CONNSTRING))
Line 292: {
Line 293: cnn.Open();
Line 294:
Line 295: using (MySqlCommand cmd = cnn.CreateCommand())
I upload it on server and it's make crash of IIS on server. now every site on server is not working. can someone please tell me how to fix it?
This exception I got on my computer. When I visit to my site I see
Service Unavailable
HTTP Error 503. The service is unavailable.
Your database lookup can't be found...check the connection strings and make sure each part you have deployed shares the same connection logic :)