locked
Microsoft.Health.HealthServiceAccessDeniedException while downloading MedicalImageStudy RRS feed

  • Question

  • I uploaded some 40 MB dicom image files in MedicalImageStudy data type.
    I am trying to download the same using the following code snippet in Online mode.
                    BlobStore blobStore = medicalImageStudy.GetBlobStore(personInfo.SelectedRecord);
    
                    if (blobStore != null)
                    {
                        foreach (Blob blob in blobStore.Values)
                        {
                            if (!blob.Name.Contains("_preview"))
                            {
                                BlobStream stream = blob.GetReaderStream();
                                byte[] buffer = new byte[1024];
                                Int32 bytesRead;
    
                                FileStream fileStream = new FileStream(@"C:\Temp\OutFile.dicom", FileMode.Create);
    
                                while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
                                {
                                    fileStream.Write(buffer, 0, bytesRead);
                                }
    
                                fileStream.Flush();
                                fileStream.Close();
                            }
                        }
                    }
    



    After downloading around 2 MB of the file, I'm getting HealthServiceAccessDeniedException.


    Exception Details: Microsoft.Health.HealthServiceAccessDeniedException: Access is denied

    Error Code: 11

    Stack Trace:

    at Microsoft.Health.EasyWebRequest.WaitForCompletion() in C:\Users\mark\Desktop\HealthVaultDLLSource\Core\EasyWebRequest.cs:line 754

       at Microsoft.Health.EasyWebRequest.Fetch(Uri url) in C:\Users\mark\Desktop\HealthVaultDLLSource\Core\EasyWebRequest.cs:line 208

       at Microsoft.Health.EasyWebRequest.Fetch(Uri url, IEasyWebResponseHandler customHandler) in C:\Users\mark\Desktop\HealthVaultDLLSource\Core\EasyWebRequest.cs:line 249

       at Microsoft.Health.HealthServiceRequest.ExecuteInternal() in C:\Users\mark\Desktop\HealthVaultDLLSource\Core\HealthServiceRequest.cs:line 140

       at Microsoft.Health.AuthenticatedConnection.ExecuteRequestWithRetry(HealthServiceRequest request) in C:\Users\mark\Desktop\HealthVaultDLLSource\Core\AuthenticatedConnection.cs:line 1033

       at Microsoft.Health.HealthServiceRequest.Execute() in C:\Users\mark\Desktop\HealthVaultDLLSource\Core\HealthServiceRequest.cs:line 125

       at Microsoft.Health.ApplicationConnection.GetPersonInfo() in C:\Users\mark\Desktop\HealthVaultDLLSource\Core\ApplicationConnection.cs:line 1273

       at SamplePage.Button1_Click(Object sender, EventArgs e) in C:\ HealthVaultImagingSample\website\Default.aspx.cs:line 159

       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)

       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


    I'm using the same application id as the one in MedicalImageStudySample application.
    Please help me resolve this issue.

    Thanks.
    Wednesday, January 13, 2010 1:34 PM

Answers

  • Hello John,

    I am not able to reproduce this issue. I am able to download all the blobs from the store (more than 2MB).

    Have you tried running the sample application? Are you facing this issue only with this particular image study or particular user?

    Thanks and Regards,
    Aneesh D.
    Thursday, January 14, 2010 6:09 PM

All replies

  • Hello John,

    Can you please clarify the following. From the call stack it seems that the Access denied error is originating from the GetPersonInfo call. Have you tried using the sample application for Medical Image Study? If you use the same image study in the sample application does the study get listed properly or you are getting the same error?

    I am trying to reproduce this scenario. I will get back to you with the results as soon as possible.

    Thanks and Regards,
    Aneesh D.
    Wednesday, January 13, 2010 8:17 PM
  • Hello John,

    I am not able to reproduce this issue. I am able to download all the blobs from the store (more than 2MB).

    Have you tried running the sample application? Are you facing this issue only with this particular image study or particular user?

    Thanks and Regards,
    Aneesh D.
    Thursday, January 14, 2010 6:09 PM
  • Hi,

        When i try to upload image i am getting Access Denied Error.However i have set all permission on config

    But still not luck.Below is my code

          Microsoft.Health.ItemTypes.File file = new Microsoft.Health.ItemTypes.File();
                string path = @"C:\Sample.jpg";
                file.SetContent(path, new CodableValue("image/jpg"));
                BlobStore blobStore = file.GetBlobStore((HealthRecordAccessor)null);

                byte[] fileContent = file.Content;

                blobStore.Clear();
                Blob blob = file.GetBlobStore((HealthRecordAccessor)null).NewBlob(string.Empty, file.ContentType.ToString());
                blob.WriteInline(fileContent);
                HealthRecordAccessor hra = new HealthRecordAccessor(l_ApplicationConnection, l_PersonInfo.PersonId); //recordId is the Guid of the Offline Sample.
                hra.NewItem(file);
                return View();

    Please assist me how can i do.

     Regards

     Satinder Singh

    Saturday, August 23, 2014 4:52 PM