これは、ワーカーロールでホストされるVMに関連する問題です。私には単純なワーカーの役割があり、その中のプロセスにまたがっています。生成されるプロセスは、32ビットでコンパイルされたTCPServerアプリケーションです。ワーカーロールにはエンドポイントが定義されており、TCPサーバーはワーカーロールのエンドポイントにバインドされています。したがって、ワーカーロールエンドポイントに接続して何かを送信すると、TCPserverはそれを受信し、処理して何かを返します。したがって、ここでは、外部に公開されているワーカーロールのエンドポイントは、内部で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
}
};
正常に動作していました。しかし、突然サーバーが応答を停止しました。ポータルにチェックインすると、VMの役割が自動的に再起動していました。しかし、それは決して成功しませんでした。Role Initializing..
ステータスを表示していました。手動による停止と開始も機能しません。コードを変更せずに同じパッケージを再デプロイしました。今回は展開自体が失敗しました。
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.
しかし、しばらくしてからもう一度デプロイしようとすると、正常に機能しました。誰かが私に何が問題になるのか教えてもらえますか?
アップデート:
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");
}
}