Logging in Web role MVC - asp.net-mvc-4

I have an ASP.NET MVC 4 web application. I need to be able to log controller logic.
Now i have created a Windows Azure project and added a web role and added this web application as a web-role.
How can I log when the the website is running as a cloud service?

Windows Azure Diagnostics enables you to collect diagnostic data from a worker role or web role running in Windows Azure.
The Windows Azure diagnostic monitor runs in Windows Azure and in the compute emulator to collect diagnostic data for a role instance. Log data will be periodically saved to a storage account where it can be examined.
For step-by-step instructions refer to Enabling Diagnostics in Windows Azure.
For additional information refer to Collect Logging Data by Using Windows Azure Diagnostics, Diagnostics and Debugging in Windows Azure and Windows Azure Diagnostics–From the Ground Up.
For advanced dianostic management features check Azure Diagnostics Manager (free trial available).

Related

In Azure, want to send logs of Windows Virtual machines to 2 different Logs Workspace

In Azure, want to send logs of Windows Virtual machines to 2 different Logs Analytics Workspace. I have different resource groups that want to collect logs there themselves in Logs Analytics and security logs(custom logs) to centralize(single) Logs Analytics Workspace from different resource groups.
Is it possible to send logs to multi-workspace analytics?
Since you have windows VM, you can setup to send to multiple Log Analytics Workspaces (multi-homing).
Extension is applicable for Azure Virtual Machines. Direct agent can be used for Azure and non-Azure Virtual Machines(on-premise). The agent isn't only for connecting to Azure Monitor. Other services such as Azure Security Center and Azure Sentinel rely on the agent and its connected Log Analytics workspace
If automatic provisioning is On, Security Center provisions the Log Analytics Agent on all supported Azure VMs and any new ones that are created.
Note: Windows agents can connect to up to four workspaces, even if
they are connected to a System Center Operations Manager management
group.
The Linux agent does not support multi-homing and can only connect to
a single workspace or management group.

Why can't authorized user publish azure cloud service worker role app to azure cloud service container?

I have a single MSDN subscription (with $150 per month credit on Azure). I am experimenting with cloud service worker role app in Azure. I have 2 user accounts (say A for Admin and B for Developer) with Azure. I provisioned a cloud app as user A and gave rights to user B with Owner and Contributor roles. I logged into Azure as user B and can see clearly see this cloud service empty container. Next, as user B (developer), I authored a cloud service with worker role (using VS 2015 enterprise) and tested on my personal machine. When I try to publish this app to azure after logging in as user B (through visual studio), the Publish Azure Application dialog box shows my MSDN subscription. Once I select the subscription, it shows a red x mark next to the subscription. When I hovered over the red x mark, it says "Cloud Serivces are not available in this subscription.". What am I doing wrong?
I had both VS 2013 as well as VS 2015 installed on my machine. However I had installed Azure SDK 2.8 for VS 2015 only. With this setup, I was not able to publish the cloud service to azure. Today I installed the same SDK for VS 2013 as well. All of a sudden I can publish and view my cloud services through server explorer in both VS 2013 as well as VS 2015. Go figure!

How to get error log in windows Azure server?

I have developed test application to display claims of authenticated identity.
this application is working in local but when I publish to windows azure it gives some dot net error. Can Anybody explain me how to get error log in windows azure server?
Thanks in Advance !!!
I suspect you aren't looking for help with Azure Storage - or just in case you are I have included a detailed explanation below. For Azure log information see here: Windows Azure PaaS Compute Diagnostics Data.
If it is storage you are interested in, the following blog post provides a good overview of the logging capability: Windows Azure Storage Logging:Windows Azure Storage Logging: Using Logs to Track Storage Requests.
Jason

Debug Azure application without using Azure Storage Emulator

When debugging in Visual Studio, Azure Storage Emulator always starts automatically, even if my web role configuration points to the storage account credentials (*.blob.core.windows.net) and not the storage emulator. Is there any way to debug and not use the development storage at all?
The emulator starts for your web roles probably. What application is using storage? You can't debug Azure storage. You can only debug an app that is calling storage.

Azure Compute Emulator Admin Priviledges - Registering WCF URL

I am working on upgrading a project to Windows Azure 1.3 and I am running into an issue with hosting WCF services in an Internal Web Role. I get the following exception when trying to access the services:
HTTP could not register URL http://127.0.0.1:5111/service.svc/. Your process does not have access rights to this namespace
I did have a similar issue when working with Azure 1.0 and resolved it by with the following code:
new BasicHttpBinding() { HostNameComparisonMode = HostNameComparisonMode.Exact }
With this new issue, there seem to be a few common solutions; using the above code, runing the httpcfg tool to explictly change namespace reservation, and running as Administrator.
As far as I know, the httpcfg tool will not work for an Azure Internal WebRole because the port is dynamically assigned. Running Visual Studio as Administrator and debugging the Cloud project does not fix the problem either (Visual Studio does launch the Emulator).
It seems like the Azure Compute Emulator does not inherit the permissions from the Visual Studio process. Has anyone run into a similar problem, any ideas on fixes, work-arounds?
Karl
Okay, my suspisions were proved correct. When the Azure Compute Emeulator starts, it adds the Web Role instances in IIS, but the App Pool Identity does not have permissions to register namespaces.
I found this blog article which describes how to change the identity of the app pool when a Web Role instance is started.
http://www.wadewegner.com/2011/01/programmatically-changing-the-apppool-identity-in-a-windows-azure-web-role/
This is a less than ideal solution, but works.