Easier way? Azure Websites, Application logging asp.net - asp.net

When I get a call there was an error in our web application when running on a windows server I would simply go to Windows Logs and scroll down the application logs and find the Warning. Easy to read and made it quick to solve the problem.
Now I'm testing out Azure Websites to run asp.net applications and i'm racking my brain trying to figure out how to have the same kind of quick error find a fix process.
Viewing the application logging in Azure's application diagnostics is utterly useless.
It would take me forever to dig through those logs. rewriting the application to handle errors differently is not an option for me.
So who else is having this problem? any solutions?

The easiest solution is to offload your error logs to a separate service like Raygun. This will result in a (small) monthly fee but is a 5 minute setup and you are good to go.
Otherwise you can go and use Log4net to log your error to the blob storage but then you will have to poll that one for your logs.

Try the Azure Website Log Browser site extension, you can install it from the new Azure Portal on your website (as a site extension) and it makes it easier to view all of your logs.
Read more about it here.

Related

.Net core application failing to upload via FTP, hosted on IIS

I have a problem deploying a .net core application via FTP which is hosted on IIS.
The main DLLs (core application) that I want to update just wont upload, FTP just gives me a generic permission error message. I think the reason is because they are in use because then I stop the application pool, upload and restart it works just fine.
But this isn't really a solution, are there any other methods of publishing that will alleviate this problem?
Edit:
"open for write: failure"
Is the only error I'm getting. I can't find anything online and the only solution I have is restart the app pool.
I found an answer and I figured it should be here for future Googling.
The issue is as I first expected IIS proxies the request to kestrel and that means the process is in use as far as Windows is concerned. There are three solutions.
The Good Solution
Have two (or more) VMs on azure behind a load balancer. Have a script which turns off the sites one at a time, does what it needs to do and turns them back on. Do this right and no downtime!
Intermission
Before I talk about the other solutions a little explanation. I have not been working with .NET for a long time but apparently there was this thing you could do where you add a app_offline.htm and it will temporarily take down the site for you.
In the context of IIS and .Net Core it also releases the process, which is really useful as it solves my problem! Although I had to visit the web page first for it to take effect, unless I'm mistaken.
The Bad Solution
Use an automated script to rename _app_offline.htm to app_offline.htm. Do the upgrade and then revert that change. Takes your site down, kind of ugly but scripting is always better than...
The Ugly Solution
You only have access to FTP, no remote admin or proper deployment process because... reasons.
Upload an app_offline.htm, upload as little as possible and hope it doesn't break anything before deleting or renaming app_offline.htm.
Also you would have to perform any DB migrations by using EnableAutomaticMigrations = true because you have no server access or scripting methods.

Can't log into ASP.NET MVC site once on IIS

I finally got my ASP.NET MVC application hosted on my local Windows/IIS server. I went to the login page but when I try to log in it says,
Error:
An error occurred while processing your request
This is fairly non-descript...
My gut feeling is that when I did the web deploy, I didn't deploy the localdb(?) where the users' credentials are stored. Before I try to re-deploy the entire app, I'd like to see if anyone can offer some guidance. Am I on the right track? Are there other possible causes/solutions I should investigate?
I'm using the default registration/login system that is in the project to start with, and it woks just fine in VS. I did a regular web deploy to my IIS server, and the site works just fine until you go to log in.
Fixed: This issue was caused (as suspected) by the inaccessibility of the LocalDB where all the users' credentials are stored. VS uses this light DB instead of making you install SQL Express or another alternative (much like IIS Express works better for debugging than full IIS). When I push my application to IIS from VS, the database wasn't connecting. I eventually found this other SO question, and the top answer fixed my issue.
How to deploy ASP.NET MVC 4 application using localDB to local IIS on Windows 7?
This will solve the issue, but there is a lot of conflict on the web as to whether or not it is ok to use LocalDB in production, so if you have a lot riding on your project you might want to take a look at that. For my purpose, LocalDB is just fine, so this solved the issue. Thank you to all who responded to my (admittedly) broad question. I'm sure this will be a useful thread for others with the same issue.

Detecting and alerting when web.config is corrupt

We recently ran into a situation where a bungled web.config deployment resulted in two 'appSettings' sections in our web.config. We've got detailed error shut off (it's prod) and so in the browser we saw a generic 500 error. Checking Windows application log revealed nothing.
Is it possible to set up some kind of alerting for a case like this? Something (anything!) logged to the Windows application log would be ideal.
Thanks for looking!
You can add an error logging module to help you debug your application. I found ELMAH to be a very good tool. Here's how you log errors using ELMAH.
ELMAH can help you debug your application in the future. Whenever you make changes to your application, test it before publishing the changes. A good way of doing it would be to set up a Staging environment to match the Production server. That way you would be able to see any errors before moving the changes to your live application.

Log messages from Web API to console in .NET 4 and IIS6

Coming from Java servlet containers, I really find it annoying that the IIS server (I am stuck with IIS6 on Windows Server 2003) does not have a console output that can be used to log messages into.
Is there a way to do this? I'd like to debug a particularly specific hardware/software deploy configuration that doesn't make my RESTful service, written with WebAPIs in .NET 4, work properly.
I'm thinking if there is some way to write to an output buffer and then consume it by attaching to that particular stream from a cmd console window.
Thank you.
I ended up writing events in the Windows Event log. A crappy solution for a crappy way of doing stuff, if you ask me.

How do I monitor ASP errors

I come from a mainly PHP background and make good use of the Apache error logs by using the command line. I've recently been handed a large ASP/ASP.NET project that I need to make changes to, where do I find the error logs on a Windows IIS setup so that I may troubleshoot some issues?
You haven't said which version of IIS you are using. In IIS 6, the HTTP error log is located in systemroot\System32\LogFiles\HTTPERR.
ASP.net itself won't produce any error logs unless it is configured to do so. There are many ways to do this for example with Log4net, Enterprise Library Logging Application Block, trace diagnostics or a roll your own approach.
Have a look in the web.config file and see if/how logging is configured for the application.

Resources