2013-05-04 63 views
2

我正在使用WCF服務和Azure進行遊戲。Microsoft Azure實例部署中的RoleEnvironmentException

我有幾個WCF服務在Azure上成功運行,此特定服務一直運行正常,直到我決定在不同的(現有)Cloud Service下重新部署它。

我將其從我的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

Remoting的很少的文章在該實例中,我將在事件查看器以下:

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> 

進入

回答

6

好吧,this正是解決了這個問題。 我在Imports結束標記下的ServiceDefinition.csdef文件中添加了以下內容。根本不存在,只要我在下面添加併發布實例即可啓動。

使用1.8版

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

幫助這可以幫助別人一天。

+1

只是好奇 - 你指的是改變''的''元素有一個更大的'sizeInMB'值?如果是這樣,你應該編輯你的答案,明確地說出來,所以它真的*不會幫助別人有一天。此外,只是好奇你使用哪個版本的工具。我上週創建了一個項目(v1.8),我的'sizeInMB'值是20000.這是你的默認值嗎?你改變你的價值是什麼? – 2013-05-05 00:21:07

+0

@DavidMakogon好點。編輯。 – Damo 2013-05-05 09:34:28