Windows Azure Websites

bryanmig

Posted on
Jun 13 2013

I am trying to deploy my app to Windows Azure Websites (Shared instance) but I get the following exception when attempting to send data to RayGun:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

with this stack trace:

[UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]
   System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
   System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) +10755486
   System.Management.ManagementScope.InitializeGuts(Object o) +389
   System.Management.ManagementScope.Initialize() +177
   System.Management.ManagementObject.Initialize(Boolean getObject) +528
   System.Management.ManagementClass.GetInstances(EnumerationOptions options) +121
   System.Management.ManagementClass.GetInstances() +6
   Mindscape.Raygun4Net.Messages.RaygunEnvironmentMessage.GetCpu() +55
   Mindscape.Raygun4Net.Messages.RaygunEnvironmentMessage..ctor() +527
   Mindscape.Raygun4Net.RaygunMessageBuilder.SetEnvironmentDetails() +30
   Mindscape.Raygun4Net.RaygunClient.BuildMessage(Exception exception) +86
   Mindscape.Raygun4Net.RaygunClient.Send(Exception exception) +27

jeremy

Raygun

Posted on
Jun 24 2013

This sounds like it might be a trust related issue. Have you set mediumTrust=true in your config section? If not add that in and see if it covers the issue :)


Jeremy


bryanmig

Posted on
Jul 12 2013

I added

  <system.web>
    <trust level="Medium" />
  </system.web>

to my web.config but this causes another error:

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

This can be seen live here: http://migliorisi.azurewebsites.net/test where my controller's action contains one line:

new Mindscape.Raygun4Net.RaygunClient(raygunKey).Send(new Exception("Testing here"));

martin308

Posted on
Jul 15 2013

Hi,

The mediumtrust attribute will need to go onto the raygun settings element of your config eg.

<RaygunSettings mediumTrust="true" apikey="yourkey" />

Sorry about the confusion. This will stop the Raygun client from trying to get information it is not allowed to in Azure.


bryanmig

Posted on
Jul 15 2013

Aha! Perfect, its working now. Thanks for clearing that up for me.

Which information will not be available with medium trust on Azure?


martin308

Posted on
Jul 15 2013

No problem, glad you have it working.

The majority of the data on the environment tab will not be collected with this set. Architecture, TotalPhysicalMemory, AvailablePhysicalMemory, TotalVirtualMemory, AvailableVirtualMemory, CPU & disk space.


gorgiRankovski

Posted on
Dec 03 2013

This is stupid! Why isn't the RaygunClient catch such exceptions and set N/A to those properties :(

Just lost bunch of time trying to resolve this as I'm using ServiceStack and I was trying find the error in the framework, not the Raygun client.

Please fix this!


John-Daniel Trask

Raygun

Posted on
Dec 03 2013

Hi

Sorry for the frustration. It sounds like you have a slightly older version of the .Net Raygun provider. The latest version in GitHub and NuGet will catch these exceptions and set the environment properties to default values. Update the Raygun provider you are using in your application and this problem will be resolved.

-Jason


Reply