2

WCF サービスと Azure でゲームをしています。

Azure で正常に実行されている WCF サービスがいくつかあります。この特定のサービスは、別の (既存の) クラウド サービスに再デプロイすることを決定するまで、正しく動作していました。

VS ソリューションのクラウド サービス X の役割から削除し、別のクラウド サービスの役割に追加しました。公開したときに、"未処理の例外: Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentException" という例外エラーが表示されます。サービスは常にリサイクルされていると言われています。

このメッセージは、この WCF サービスが存在するインスタンスの下の Azure 管理ポータルに表示されます。独自のクラウド サービスと、複数のインスタンスを持つサービスで試してみました。

この問題に関するわずかな記事 ( http://blogs.msdn.com/b/davidmcg/archive/2011/03/10/diagnosticmonitor-roleenvironmentexception-was-unhandled.aspx ) および ( http://www.microsofttranslator. com/bv.aspx?from=&to=en&a=http%3A%2F%2Fpul.se%2FBlog-Post-Error-RoleEnvironmentException-was-unhandled_Video-ptFrIOhJU6%2ClWCxfMvJiNbE )

インスタンスにリモート接続すると、イベント ビューアーに次のように表示されます。

Application: WaIISHost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentException
Stack:
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

私も見つけました:

Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentException: error
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetLocalResource(String localResourceName)
   at WCFServiceDataTransfer.AzureLocalStorageTraceListener.GetLogDirectory()
   at WCFServiceDataTransfer.WebRole.OnStart()

ただし、これは AzureLocalStorageTraceListener で自動生成されたコードです。

この問題の根底に到達するにはどうすればよいですか?

Web.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--  To collect diagnostic traces, uncomment the section below or merge with existing system.diagnostics section.
        To persist the traces to storage, update the DiagnosticsConnectionString setting with your storage credentials.
        To avoid performance degradation, remember to disable tracing on production deployments.
  <system.diagnostics>     
    <sharedListeners>
      <add name="AzureLocalStorage" type="WCFServiceDataTransfer.AzureLocalStorageTraceListener, WCFServiceDataTransfer"/>
    </sharedListeners>
    <sources>
      <source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
        <listeners>
          <add name="AzureLocalStorage"/>
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
        <listeners>
          <add name="AzureLocalStorage"/>
        </listeners>
      </source>
    </sources> 
   </system.diagnostics> -->
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">        
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <client />
    <services>
      <service behaviorConfiguration="TransferServiceBehavior" name="WCFServiceDataTransfer.TransferService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="TransferService" contract="WCFServiceDataTransfer.ITransferService">
        </endpoint>
      </service>

    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="TransferService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
          transferMode="Streamed">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>

        <behaviors>
      <serviceBehaviors>
        <behavior name="TransferServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" maxConcurrentInstances="500" />

        </behavior>
        <behavior>                   
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
    -->
    <directoryBrowse enabled="true" />
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
    <httpRuntime maxRequestLength="2097151" useFullyQualifiedRedirectUrl="true" executionTimeout="14400"   />   
  </runtime>
</configuration>

エントリ

public class WebRole : RoleEntryPoint
    {
        public override bool OnStart()
        {
            // To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config  
            DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
            diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
            diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            return base.OnStart();
        }
    }
4

1 に答える 1

6

わかりました、これで問題は解決しました。Imports 終了タグの下の ServiceDefinition.csdef ファイルに以下を追加しました。以下を追加してインスタンスを公開すると、まったく存在しませんでした。

バージョン 1.8 の使用

<LocalResources>
   <LocalStorage name="WCFServiceDataTransfer.svclog" sizeInMB="1000" cleanOnRoleRecycle="false" />
</LocalResources>

これがいつか他の誰かを助けるのを手伝ってください。

于 2013-05-04T23:03:40.853 に答える