0

I am new to azure development. I have a azure application works fine locally, but throws SEHException when deployed on azure. When publishing using Visual Studio, the activity log shows that both the instances are stuck on recycling. I connected to a instance using Remote Desktop and tried accessing the application with browser on that instance.

I am getting the following Exception.

Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception

StackTrace:
[SEHException (0x80004005): External component has thrown an exception.]
   RdGetLocalResource(UInt16* , _RD_RESOURCE** ) +0
   _LOCALRESOURCE.GetLocalResourceW(UInt16* name, _LOCALRESOURCE** ppout) +309
   Microsoft.WindowsAzure.ServiceRuntime.Internal.InteropRoleManager.GetLocalResource(String name, InteropLocalResource& ret) +57
   Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetLocalResource(String localResourceName) +231
   MyApp.Web.Infrastructure.Services.AzureLocalStorageService.GetLocalResourceRootPath(String name) +27
   MyApp.Infrastructure.AzureStorageAccountFactory.Create() +117
   MyApp.IoCConfig.RegisterDependencies() +667
   MyApp.Web.MvcApplication.Application_Start() +260

[HttpException (0x80004005): External component has thrown an exception.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4058693
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext conext, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): External component has thrown an exception.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11703936
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4870757

It shows that RoleEnvironment.GetLocalResource is causing error. There is another question Why am I getting SEHException when calling RoleEnvironment.GetConfigurationSettingValue("MYKEY")? which gets same exception on RoleEnvironment.GetConfigurationSettingValue. But there the error was in local environment. Here the app tuns fine in Local environment, buts fails on azure. What could be the reason?

Here are my ServiceDefinition and ServiceConfguration.Cloud files

ServiceDefinition.csdef

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyApp.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-05.1.7">
  <WebRole name="MyApp.Web" vmsize="ExtraSmall">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
    </Imports>
    <ConfigurationSettings>
      <Setting name="StorageConnectionString" />
      <Setting name="MediaAccountName" />
      <Setting name="MediaAccountKey" />
    </ConfigurationSettings>
    <LocalResources>
      <LocalStorage name="UploadedVideosCache" cleanOnRoleRecycle="false" sizeInMB="10240" />
      <LocalStorage name="TraceFiles" cleanOnRoleRecycle="true" sizeInMB="50" />
    </LocalResources>
  </WebRole>
</ServiceDefinition>

ServiceConfiguration.Cloud.cscfg

<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="MyApp.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2012-05.1.7">
  <Role name="MyApp.Web">
    <Instances count="2" />
    <ConfigurationSettings>
      <Setting name="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=[accountname];AccountKey=[primary account key]" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="[remoteusername]" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="[encryptedpassword]" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2013-09-15T23:59:59.0000000+05:30" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
      <Setting name="MediaAccountName" value="[mediaservicesaccountname]" />
      <Setting name="MediaAccountKey" value="[mediaservicesaccountkey]" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="[thumbprint]" thumbprintAlgorithm="sha1" />
    </Certificates>
  </Role>
</ServiceConfiguration>
Community
  • 1
  • 1
Kedar Vaidya
  • 678
  • 1
  • 7
  • 14
  • If you could supply your csdef file and the Cloud cscfg, that would help to narrow things down. – Mark Rendle Sep 15 '12 at 12:44
  • I have supplied ServiceDfinition.csdef and ServiceDefinition.Cloud cscfg file with placeholders for AccountName/AccountKeys/Passwords – Kedar Vaidya Sep 15 '12 at 13:54
  • This is kind of a stretch, and for ExtraSmall you have a little over 13GB for Local Resource, so you *should* be ok, but wonder if you drop UploadVideosCache by a factor of 10 if there's any difference? – Jim O'Neil Sep 15 '12 at 21:38
  • possible duplicate of [Why am I getting SEHException when calling RoleEnvironment.GetConfigurationSettingValue("MYKEY")?](http://stackoverflow.com/questions/2957938/why-am-i-getting-sehexception-when-calling-roleenvironment-getconfigurationsetti) – David Makogon Sep 15 '12 at 22:48
  • @JimO'Neil: I tried reducing the size of 'UploadedVideosCache' to 1GB, still the same error. Then I removed 'UploadedVideosCache' local storage, and tried to access 'TraceFiles' storage, still the same error – Kedar Vaidya Sep 16 '12 at 08:21
  • Hello Kedar, Please let us know if you resolved it. We are trying to overcome with same issue. Regards, – Systematix Infotech Oct 31 '14 at 04:27

0 Answers0