Implement and debug a WCF Service in Windows Azure (below)

Source: Internet
Author: User

Enable Diagnosis

For us, most of the diagnosis-related work has been completed. But remember, we must add "sharedListener" to "AzureLocalStorage. To do this, you only need to exchange the commented "system. diagnostics" node in the "Web. Config" file of "WCF Web Role", which is so simple.

In addition, you must add the following line of code to the "WebRole. cs" file:

DiagnosticMonitor. Start (CloudStorageAccount. DevelopmentStorageAccount, diagnosticConfig );

When I used SDK 1.3 to migrate logs to BlobStorage, I encountered a problem. This issue is related to the available permissions on the files created as SVCLog. There are two solutions to this problem. First, you can imitate javasdotnet (For details, refer to: http://robindotnet.wordpress.com/2011/02/16/azure-toolssdk-1-3-and-iis-logging/ -- I will describe how to do it in a later article), or, you can also in "ServiceDefinition. in csdef, the <Sites> node is completely deleted, which means that it will no longer run as a complete IIS. I chose the first method. In this article, I simply summarized how I made it work normally. I will write an article to explain it in the future. Now, if you cannot solve the known issues In SDK 1.3, you can directly access these files by browsing their file paths (using Development Emulator, alternatively, you can use Remote Desktop to access logs in the cloud.

If you are curious about the WCF tracking logs that can be used immediately, you can open the affiliated Project and see how it works for you-you can focus on "FixDiagFolderAccess. ps1 "on the powershell script. It creates some access control tables for this folder. More importantly, it creates a NULL or completely empty placeholder for this file (We will rewrite this file at last ).

It provides you with SVCLog definitions, including all the details of binding and exceptions. Here, you can find "DivideByZeroException" and start to diagnose the problem.

This file will first appear on the hard disk:

A moment later (note that in this blog post, there is no hint at this time !), The Windows Azure Diagnostics System will migrate this file to the WAD-TraceFiles container of blob storage.

After that, the log can be downloaded to check for errors. In this example, we can scroll down until we find the details related to division by 0. Then we will find an exception in the red highlighted row. To view more details, we can obtain the real stack trace information of this error from the server.

The source code of this blog can be downloaded from the following address:

Http://assets.bareweb.eu/wp-content/uploads/2011/03/WCFBasic.zip

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.