Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:25:04+00:00 2026-06-05T03:25:04+00:00

I have an Azure WebRole with the following code: public override bool OnStart() {

  • 0

I have an Azure WebRole with the following code:

public override bool OnStart()
{
    setDiagnostics();

    TestClass test = new TestClass();

    return base.OnStart(); 
}

private void setDiagnostics()
{
    string wadConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";
    CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(wadConnectionString));

    DeploymentDiagnosticManager deploymentDiagnosticManager = new DeploymentDiagnosticManager(cloudStorageAccount, RoleEnvironment.DeploymentId);
    RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = cloudStorageAccount.CreateRoleInstanceDiagnosticManager(
        RoleEnvironment.DeploymentId,
        RoleEnvironment.CurrentRoleInstance.Role.Name,
        RoleEnvironment.CurrentRoleInstance.Id);

    DiagnosticMonitorConfiguration diagConfig = roleInstanceDiagnosticManager.GetCurrentConfiguration();

    if (diagConfig == null)
        diagConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();

    diagConfig.WindowsEventLog.DataSources.Add("Application!*");
    diagConfig.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1D);

    roleInstanceDiagnosticManager.SetCurrentConfiguration(diagConfig);

    DiagnosticMonitor.Start(wadConnectionString, diagConfig);
}

In the constructor of my TestClass is the following code:

EventLog.WriteEntry("TestClass", "Before the try", EventLogEntryType.Information);
try
{
    EventLog.WriteEntry("TestClass", "In the try", EventLogEntryType.Information);
    Int32.Parse("abc");
}
catch (Exception ex)
{
    EventLog.WriteEntry("TestClass", ex.Message, EventLogEntryType.Error);
}

For some reason this code works well if I run it in debug mode with a break point on the OnStart method and running through the code with F11. However, I do not see any EventLog entries in my WADWindowsEventLogsTable if I remove all breakpoints and just run it. So this seems like a timing issue to me… Does anyone know why my code is performing this behaivor?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:25:06+00:00Added an answer on June 5, 2026 at 3:25 am

    The problem was the EventLog.WriteEntry() method. I used the source “TestClass” as EventLog source. However I never created this source with a startup task and due to insufficient privileges it failed to log my entries.

    So the solution: create an own source with a startup task or use trace messages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF application hosted as a webrole in Azure with the following
I have MVC project on Windows Azure. This project has WebRole with method OnStart.
I have a simple WebRole class in my Azure solution: public class WebRole :
Situation: I have set up an Windows Azure webrole in visual studio 2010 to
I have an Azure webrole in my VS project. I have assemblies in my
I m using the local system to test session on windows azure. I have
I have a problem deploying a WebRole (WCF service) to Azure . My WebRole
I have a windows azure Webrole application using Silverlight on top of WCF+ASP.NET. I
I have developed one web application for monitoring azure application (Webrole) by console(EXE) application
I have a singe webrole in my azure account and I want to mantain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.