I have an ASP.NET application and want to process exceptions by Application_Error method in Global.asax.
In config I use customError="Off" setting.
All works fine on local or remote server. Application_Error method executes and redirects to custom error pages.
But after I deploy app in Azure, I always get default error pages (YSOD). I think, Application_Error handler in Global.asax not fires.I haven't any ideas why. Maybe Azure has special setting for choose fire this handler or not.
Can anyone explain this?
If I set customError="RemoteOnly" setting and add default redirect page, all works.
But I have business logic in my handler, therefore I want to use Application_Error method.
Oh, I finally resolve my problem. ASP NET works fine and handle exceptions, but I have app setting in web config for enable/disable custom error pages. This setting processed in Application_Error method. And Azure has app setting too, and they override settings from web config.
For more info about Azure app settings: http://blogs.msdn.com/b/martinkearn/archive/2015/10/09/using-app-settings-in-azure-web-apps.aspx
Related
I am attempting to create a custom error page display to run in my app when there is an issue with the database connection string.
When I alter the string to something invalid, I receive the error mentioned in the title above.
Is there any way to override this page and show a more informative one that would tell me that my DB connection string is wrong?
There is a InvalidOperationException that is thrown in the Startup.cs file, but I'm unsure on how to extract this from the startup file and use it, when my app fails to start in the first place.
Is this possible to do?
You can disable the default error page by using the disableStartUpErrorPage="true" setting in web.config for the IIS hosting module. This will just fallback to another custom error page of your choosing served by IIS, rather than allowing you to show a dynamic custom page.
Documentation
I need to use the pdftron.PDF.Convert.ToXod but this exception comes:
Message: An error occurred while converting the file.Detailed error:Error creating a new Word application instance.Log: Start check system account. Session ID is: 0. Done checking system account. Start checking registry. Registry check done. Creating a Word application instance. Conditional expression: false Filename : Convert.cpp Function : trn::PDF::Convert::ToPdf Linenumber : 1612
This function is called in an mvc website running on application pool in IIS.
The user for application pool is administrator.
i notice when i call this method from WebAPI function it throws this error, howerver if the same method is called from browser with a validated user the code works and also subsequent request to the api also start working.
the api function is without user identity [AllowAnonymous].
Please kindly help me find a reason so i can fix it. Its because i cant manually go and call this from browser every time application pool restarts the website, i want that if api calls this first , then it be successfully done , i also tried to call PDFNet.Initialize function at global.asax , it does nothing different.
The following links will probably help you.
https://www.pdftron.com/pdfnet/faq_files/Converting_Documents_in_Windows_Service_or_ASP.NET_Application_using_PDFNet.pdf
https://groups.google.com/d/msg/pdfnet-webviewer/F5SdHgb__1w/PSjoj22qCwAJ
Or try the test project to validate your IIS setup.
https://www.pdftron.com/ID-zJWLuhTffd3c/support/PDFNet_IIS_Word_ToXod_Test2013.7z
I am using IIS7.5 to force my web app to load automatically (startMode="AlwaysRunning"), and I now want to preload my cache data. I am a bit confused though because two approaches seem identical:
use Application_Start in global.asax
use serviceAutoStartProviders in IIS config files
They seem rather redundant and doing the same thing. If they are, I guess I would rather use Application_Start than create code dependencies in IIS configuration files. Any advice?
The Application_Start in the global.asax is fired when the application receives it's first request (first user or autostart) so it is not used to start the site.
Use serviceAutoStartProviders to start
http://www.asp.net/whitepapers/aspnet4#0.2__Toc253429241
The IIS Application Warm-Up Module is easier to use
http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization
I changed the compilation debug from true to false and now when I try to access the site, I get the error page isnt redirecting properly. The site is wrapped in SSL and it is deployed with debug = true and works fine but after doing some research I learned that it should be debug = false.
The error description is that the webpage redirects you in an endless loop. I am going to the home page and I dont know where the endless loop is coming from.
When you change any file in hosted web app, IIS drops application pool and with it all session states. So if you are storing something in the session oyour change may trigger some logic in your application when you are relying on session variables.
Hard to tell a root cause, but you should try setting the deployment retail=true which keeps you from having to change the web.config and does other 'production' changes as well.
http://msdn.microsoft.com/en-us/library/ms228298(v=vs.80).aspx
I have an ASP.NET 4 Web Forms app that is using URL Routing. I have the following route specified in Application_Start:
routes.MapPageRoute("Schedule", "Schedule", "~/Schedule.aspx");
Pretty simple. I just want to reroute requests for "http://example.com/Schedule" to "http://example.com/Schedule.aspx". Works great. However, if my application throws an exception while using routing, the Application_Error method in Global.asax is not executed. I see the generic .net error message instead. If I throw the same exception when using the full "Schedule.aspx" it works as expected. Any ideas?
From: http://msdn.microsoft.com/en-us/library/24395wz3.aspx
An error handler that is defined in the Global.asax file will only catch errors that occur during processing of requests by the ASP.NET runtime. For example, it will catch the error if a user requests an .aspx file that does not occur in your application. However, it does not catch the error if a user requests a nonexistent .htm file. For non-ASP.NET errors, you can create a custom handler in Internet Information Services (IIS). The custom handler will also not be called for server-level errors.
I think the bolded text why it is not working as expected. Sorry, but I don't have a nice solution.