Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Non-Sand-boxed plugin errors out "Request for the permission of type 'System.Security.Permissions.EnvironmentPermission' failed"

(0) ShareShare
ReportReport
Posted on by

I received below error while I am invoking an external web service from plugin. plugin is registered under isolation mode: 'none', stage: post, mode: Sync

Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

what other permissions/settings needs to be verified to resolve this issue?

*This post is locked for comments

  • David Jennaway Profile Picture
    14,065 on at
    RE: Non-Sand-boxed plugin errors out "Request for the permission of type 'System.Security.Permissions.EnvironmentPermission' failed"

    It makes more sense that it is a local issue, rather than on the server. There are many permissions or group policy settings that could cause this, though the most likely is access to the temporary directory. If you can, try running the plugin profiler with administrative rights

  • Community Member Profile Picture
    on at
    RE: Non-Sand-boxed plugin errors out "Request for the permission of type 'System.Security.Permissions.EnvironmentPermission' failed"

    Thanks for your response David. I realized that the web service call works fine from plugin on server but fails when i debug locally. I am using plugin profiler and attaching the profiler process to visual studio. i believe something on my machine is not allowing the plugin code to execute the web service call.

  • David Jennaway Profile Picture
    14,065 on at
    RE: Non-Sand-boxed plugin errors out "Request for the permission of type 'System.Security.Permissions.EnvironmentPermission' failed"

    I'm surprised that you get this if the plugin is not running in the sandbox, as it should run in full trust. However, it's possible that the CRM website might not be running in full trust, which could cause this. See https://stackoverflow.com/questions/8470216/system-security-securityexception-request-for-the-permission-of-type-system-se#8477634  for information on the IIS settings.

    Or maybe you could change the code so it doesn't need this permission. This permission is needed for accessing environment variables, such as to get the machine name, or  the temporary directory

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 54

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans