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 8099897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:33:42+00:00 2026-06-05T22:33:42+00:00

This is a problem is related to worker role hosted VM. I have a

  • 0

This is a problem is related to worker role hosted VM. I have a simple worker role, which spans a process inside of it. The process spawned is the 32 bit compiled TCPServer application. Worker role has a endpoint defined in it, the TCPserver is bound to the end point of the Worker role. So when I connect to my worker role endpoint, and send something, TCPserver recieves it , processes it returns something back. So here the endpoint of the worker role which is exposed to outside world, internally connects to TCPserver.

string port = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints[""TCPsocket].IPEndpoint.Port.ToString();

            var myProcess = new Process()
            {
                StartInfo = new ProcessStartInfo(Path.Combine(localstorage.RootPath, "TCPServer.exe"))
                {
                    CreateNoWindow = true,
                    UseShellExecute = true,
                    WorkingDirectory = localstorage.RootPath,
                    Arguments = port
                }
            };

It was working fine. But suddenly sever stopped to respond. When I checked in portal, VM role was restarting automatically. But it never succeeded. It was showing Role Initializing.. status. Manual stop and start also din’t work. I redeployed the same package without any change in the code. This time deployment itself failed.

Warning: All role instances have stopped
- There was no endpoint listening at https://management.core.windows.net/<SubscriptionID>/services/hostedservices/TCPServer/deploymentslots/Production that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

But after some time again I tried to deploy, it worked fine.
Can anyone tell me what would be the problem?

Update:

  public override void Run()
    {
        Trace.WriteLine("RasterWorker entry point called", "Information");
        string configVal = RoleEnvironment.GetConfigurationSettingValue("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString");
        CloudStorageAccount _storageAccount = null;
        _storageAccount = CloudStorageAccount.Parse(configVal); // accepts storage cridentials and create storage account
        var localstorage = RoleEnvironment.GetLocalResource("MyLocalStorage");
        CloudBlobClient _blobClient = _storageAccount.CreateCloudBlobClient();
        bool flag = false;

        while (true)
        {
            Thread.Sleep(30000);
            if (!flag)
            {
                if (File.Exists(Path.Combine(localstorage.RootPath, "test.ppm")))
                {
                    CloudBlobContainer _blobContainer = _blobClient.GetContainerReference("reports");
                    CloudBlob _blob = _blobContainer.GetBlobReference("test.ppm");
                    _blob.UploadFile(Path.Combine(localstorage.RootPath, "test.ppm"));
                    Trace.WriteLine("Copy to blob done!!!!!!!", "Information");
                    flag = true;
                }
                else
                {
                    Trace.WriteLine("Copy Failed-> File doesnt exist!!!!!!!", "Information");
                }
            }
            Trace.WriteLine("Working", "Information");
        }
    }
  • 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-05T22:33:44+00:00Added an answer on June 5, 2026 at 10:33 pm

    To prevent your worker role to be restart you’ll need to block the Run method of your entry point class.

    If you do override the Run method, your code should block
    indefinitely. If the Run method returns, the role is automatically recycled by raising the Stopping event and calling the OnStop method
    so that your shutdown sequences may be executed before the role is
    taken offline.

    http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.serviceruntime.roleentrypoint.run.aspx

    You need to make sure that, whatever happens, you never return from the Run method if you want to keep the role alive.

    Now, if you’re hosting the TCPServer in a console application (I’m assuming you’re doing this since you pasted the Process.Start code), you’ll need to block the Run method after starting the process.

    public override void Run()
    {
       try
       {
          Trace.WriteLine("WorkerRole entrypoint called", "Information");
    
          var myProcess = new Process()
            {
                StartInfo = new ProcessStartInfo(Path.Combine(localstorage.RootPath, "TCPServer.exe"))
                {
                    CreateNoWindow = true,
                    UseShellExecute = true,
                    WorkingDirectory = localstorage.RootPath,
                    Arguments = port
                }
            };
            myProcess.Start();
    
          while (true)
          {
             Thread.Sleep(10000);
             Trace.WriteLine("Working", "Information");
          }
          // Add code here that runs in the role instance
       }
       catch (Exception e)
       {
          Trace.WriteLine("Exception during Run: " + e.ToString());
          // Take other action as needed.
       }
    }
    

    PS: This has nothing to do with your deployment issue, I assume this was a coincidence

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

Sidebar

Related Questions

I have read a lot of related topics here regarding this problem but I
This is basically a math problem, but very programing related: if I have 1
This seems to be a problem related to Safari only. I've tried 4 on
I'm having a memory problem related to UIImageView. After adding this view to my
some time ago I happend to resolve a PG related problem with this SO
I hardly see any pointer on the following problem related to Hibernate. This pertains
This issue is somewhat related: Problem with Code Generated by XSD.EXE: Sequence of Elements
Update: This is, as I was told, no principle Python related problem, but seems
This question is related to my problem in understanding rebase, branch and merge ,
This is related to this post . I think I am having problem with

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.