none
Retrive hosted services through IIS using REST API

    Question

  • Hello,

    I am geting 403- forrebidden "The remote server returned an error: (403) Forbidden." while requesting Hosted Services.

    My code for getting list is:

    NameValueCollection RequestHeaders = new NameValueCollection();

    RequestHeaders.Add("x-ms-version", x_ms_version);

    X509Certificate cert = X509Certificate.CreateFromCertFile(CertificatePath);

    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestUrl);

    request.Method = "GET";

    request.ClientCertificates.Add(cert);

    if (RequestHeaders != null)

    {

    request.Headers.Add(RequestHeaders);

    }

    resp = request.GetResponse();

    

    The same code is working while I working in windows application.

    Is there any settign that I need to set with IIS? I am working with IIS 7.5.

    Monday, April 04, 2011 5:34 AM

All replies

  • Hi Naresh,

    A similar issue is being reported in the following thread: http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/efb73b00-3610-4a21-ae16-80543451a4d0. It seems the user under which IIS is running does not have permission to read certificate data. Since you're reading the certificate from a .cer file, I would suggest you change the permissions on that file so that the user under which IIS is running has necessary permissions to read the data. One quick and dirty way to achieve this would be to grant "Everyone" full permission on that certificate file.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

    Monday, April 04, 2011 6:39 AM
  • Hi Gaurav,

    I have tried all options, its not working under IIS.

    If I try without virtual directory then it works finem otherwise I got 404- fiorebbdden error. 

    I have given full access to "EveryOne" to test, but not succeed.

     

    Thanks,

    Naresh Goradara 

    Monday, April 11, 2011 5:53 AM