2012-12-18 3 views
3

Windows Azure 사이트를 클라우드에서 웹 사이트로 다운 그레이드하려고합니다. 이 오류가 발생합니다 :파일 또는 어셈블리를로드 할 수 없습니다 'msshrtmi, 지정한 파일을 찾을 수 없습니다.

Could not load file or assembly 'msshrtmi, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

[FileNotFoundException: Could not load file or assembly 'msshrtmi, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment() +0 Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor() +546

[TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName) +0
AzureInit.AzureHelper_GetApplicationSettings(String key) +28

[HttpException (0x80004005): The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9859725
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

나는이 어셈블리가 필요합니까? 웹 사이트가 그것을 찾지 않도록 어떻게 말합니까? 내 프로젝트에이 참조를 추가 한 : Microsoft.WindowsAzure.Diagnostics Microsoft.WindowsAzure.ServiceRuntime Microsoft.WindowsAzure.StorageClient 내 WorkerRole.cs 클래스에서

, 여기

Microsoft.WindowsAzure.CloudDrive 내 (그들과 함께 오는 모든 코드)

/// <summary> 
/// Reads settings from service configuration file. 
/// </summary> 
/// <param name="key">Setting key.</param>  
string AzureHelper_GetApplicationSettings(string key) 
{ 
    try 
    { 
     return RoleEnvironment.GetConfigurationSettingValue(key); 
    } 
    catch 
    { 
     // Setting key was not found 
     return null; 
    } 
} 

답변

5

이러한 참조를 제거합니다 : 코드

  • Microsoft.WindowsAzure.CloudDrive
  • Microsoft.WindowsAzure.Diagnostics
  • Microsoft.WindowsAzure.ServiceRuntime는 이러한 어셈블리의

대부분의 기능은 클라우드 서비스 (웹/작업자 역할)에 사용하기위한 것입니다.

지금 당신이보고있는 오류 구성을 읽을 관련이있는 것으로 보인다

Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName) +0 
AzureInit.AzureHelper_GetApplicationSettings(String key) +28 

Microsoft.WindowsAzure.ConfigurationManager NuGet 패키지를 사용하도록 AzureHelper_GetApplicationSettings의 코드를 변경하는 것이 좋습니다. 이렇게하면 ServiceConfiguration.cscfg와 Web.config (AppSettings) 사이를 자동으로 전환 할 수 있습니다. RoleEnvironment.IsAvailable (= Cloud Service) 인 경우 ServiceConfiguration.cscfg에서 읽습니다. 그렇지 않은 경우 (= 웹 사이트/가상 머신/온 - 프레미스) AppSettings에서 읽습니다. 그러나 웹 사이트에 배포하는 경우 ServiceConfiguration.cscfg에 있던 설정을 web.config의 appSettings에 추가해야합니다.

관련 문제