Thursday, March 22, 2012

Calling external webservice using certificate

I'm trying to call an external webservice which use https and certificate. I load certificate into MSIE and then made *.cer file. The problem is that if I compile simple console program which use this certificate - than all is OK. But when I compile simple rutine for SQL server and trying to run it - an exception is issued after this line:

service.ClientCertificates.Add(X509Certificate.CreateFromCertFile(certFile));

Exception is:

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

Do you have any advices?

MiSu

In order to access the file system, your assembly must be deployed with at least an EXTERNAL_ACCESS permission grant. If you're using VStudio, you can set the target permission level via the project properties. Otherwise, see http://msdn2.microsoft.com/en-us/library/ms189524.aspx for details of the CREATE ASSEMBLY syntax.

No comments:

Post a Comment