web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

WS call Dynamics V9 online permissions plugin

(0) ShareShare
ReportReport
Posted on by 107

Hello,

I'm trying to call a WS in my plugin, a simple GET query, but i'm getting always the following error message

Unhandled Exception: 
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The demand was for:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xx"
version="1"
Flags="Assertion"/>

I tried to add 

[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert, Unrestricted = true)] but it didn't help

I'm online, sandbox isolation mode.

my code is 

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";
            response = request.GetResponse();

Any idea please?

Thank you

*This post is locked for comments

I have the same question (0)
  • Netbull Profile Picture
    50 on at

    Hello Sskod,

    You can try using System.Net.WebClient.

    https://msdn.microsoft.com/en-us/library/gg509030.aspx

    I hope it help.

  • Sskod Profile Picture
    107 on at

    Hello,

    Thanks for the answer, i'm getting this

    System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission

  • Sskod Profile Picture
    107 on at

    UP

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    It looks like you have issues with Sandboxing of plugins. Can you please provide full code of your plugin?

  • David Jennaway Profile Picture
    14,065 on at

    Are you trying to access the web service anonymously, or passing credentials ? I'd expect you to get this error if you're trying to pass credentials, as only anonymous calls are supported - see  https://msdn.microsoft.com/en-us/library/gg334752.aspx 

    If you have to pass credentials, you'll probably have to get outside of the CRM sandbox via the service bus or an event hook

  • Sskod Profile Picture
    107 on at

    Hi,

    here is my code

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://xxazurexxxx&quot;);
    
                request.Method = "GET";
    
                WebResponse response = request.GetResponse();
    
                if (((HttpWebResponse)response).StatusCode == HttpStatusCode.OK)
    
                    throw new Exception("Response OK");


  • Sskod Profile Picture
    107 on at

    Hi david,

    I don't have to put credentials

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Have you tried following code - msdn.microsoft.com/.../gg509030.aspx

    One more question - what port do you use with your external endpoint and what version are you on?

  • Sskod Profile Picture
    107 on at

    Hi Andrew

    Yes, I've already tried with webClient

    I use port 81 in the WS & HTTP

    for Dynamics it's the Online version V9

    Thanks,

    Regards,

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    This is what I expected. It seems that Microsoft in v9.0 blocks endpoint calls for any other than 80 or 443 ports. Any chance you can redeploy your endpoint to port 80?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans