Want to call WCF service from Sharepoint 2013 Visual Web Part; when using this Service from Console it works perfectly.
I receive following Security Exception when using svc from webpart:
Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I´ve checked Sharepoint web.config file:
trust level="Full" label -> Ok.
Web part Added to safe Controls -> Ok.
Add safe control in package configuration -> Ok.
What am i missing?
This is my code:
using (Service1Client svc = new Service1Client(new BasicHttpBinding(),
new EndpointAddress(new Uri("http://xxxxxxxx/Service1.svc"))))
{
svc.ClientCredentials.Windows.ClientCredential.Domain = "domain";
svc.ClientCredentials.Windows.ClientCredential.UserName = "user";
svc.ClientCredentials.Windows.ClientCredential.Password = "pass";
Label1.Text = svc.GetData(123456);
}
I´m thinking about using JS and ajax to do the same. It is necessary to use a Full-trusted proxy for this?
Regards,
0 commentaires:
Enregistrer un commentaire