locked
Microsoft.Health.HealthServiceException: The application could not be found RRS feed

  • Question

  • protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                ApplicationInfo info = ApplicationConnection.GetApplicationInfo();                       
                AppName.Text += info.Name;
                AppId.Text += info.Id.ToString();
                string s = info.ActionUrl.Authority;
                List<PersonInfo> authorizedPeople = new List<PersonInfo>   (ApplicationConnection.GetAuthorizedPeople());          
                StartupData.SetActiveView(StartupData.Views[0]);
                if (IsPostBack)
                {
                    AddRandomHeightEntry();
                }            
                c_UserName.Text = PersonInfo.Name;
                Basic basic = GetSingleValue<Basic>(Basic.TypeId);

    }

            catch (HealthServiceException ex)
            {
                Error.Text += ex.ToString();
                StartupData.SetActiveView(StartupData.Views[1]);
            }

    }

    T GetSingleValue<T>(Guid typeID) where T : class
        {
            HealthRecordSearcher searcher = PersonInfo.SelectedRecord.CreateSearcher();

            HealthRecordFilter filter = new HealthRecordFilter(typeID);
            searcher.Filters.Add(filter);

            ReadOnlyCollection<HealthRecordItemCollection> items = searcher.GetMatchingItems();

            if (items != null && items.Count > 0)
            {
                return items[0] as T;
            }
            else
            {
                return null;
            }
        }

    • when from pageload  called GetSingleValue method then its definition give the error application not found at sercher.GetMatchingItems method.here its below side mension exception error text.
    • Error was encountered when trying to retrieve application data: Microsoft.Health.HealthServiceException: The application could not be found. at Microsoft.Health.EasyWebRequest.WaitForCompletion() in e:\bt\33\private\hv\prod\src\sdk\core\EasyWebRequest.cs:line 750 at Microsoft.Health.EasyWebRequest.Fetch(Uri url) in e:\bt\33\private\hv\prod\src\sdk\core\EasyWebRequest.cs:line 205 at Microsoft.Health.EasyWebRequest.Fetch(Uri url, IEasyWebResponseHandler customHandler) in e:\bt\33\private\hv\prod\src\sdk\core\EasyWebRequest.cs:line 246 at Microsoft.Health.HealthServiceRequest.ExecuteInternal() in e:\bt\33\private\hv\prod\src\sdk\core\HealthServiceRequest.cs:line 191 at Microsoft.Health.HealthServiceRequest.Execute() in e:\bt\33\private\hv\prod\src\sdk\core\HealthServiceRequest.cs:line 162 at Microsoft.Health.Authentication.Credential.MakeCreateTokenCall(String methodName, Int32 version, HealthServiceConnection connection, ApplicationTokenCreationInfo applicationTokenCreationInfo, String stsOriginalUrl) in e:\bt\33\private\hv\prod\src\sdk\core\Authentication\Credential.cs:line 535 at Microsoft.Health.Authentication.Credential.MakeCreateTokenCall(String methodName, Int32 version, HealthServiceConnection connection, Guid appId, Boolean isMra) in e:\bt\33\private\hv\prod\src\sdk\core\Authentication\Credential.cs:line 410 at Microsoft.Health.Authentication.Credential.CreateAuthenticatedSessionToken(HealthServiceConnection connection, Guid appId) in e:\bt\33\private\hv\prod\src\sdk\core\Authentication\Credential.cs:line 360 at Microsoft.Health.Web.Authentication.WebApplicationCredential.AuthenticateKeySetPair(AuthSessionKeySetPairs keySetPairs, HealthServiceConnection connection, Guid applicationId, X509Certificate2 certificate) in e:\bt\33\private\hv\prod\src\sdk\core\Authentication\WebApplicationCredential.cs:line 1173 at Microsoft.Health.Web.Authentication.WebApplicationCredential.AuthenticateKeySetPair(HealthServiceConnection connection, Guid applicationId, X509Certificate2 certificate) in e:\bt\33\private\hv\prod\src\sdk\core\Authentication\WebApplicationCredential.cs:line 1102 at Microsoft.Health.Web.Authentication.WebApplicationCredential.Authenticate(HealthServiceConnection connection, Guid applicationId) in e:\bt\33\private\hv\prod\src\sdk\core\Authentication\WebApplicationCredential.cs:line 488 at Microsoft.Health.Web.Authentication.WebApplicationCredential.AuthenticateIfRequired(HealthServiceConnection connection, Guid applicationId) in e:\bt\33\private\hv\prod\src\sdk\core\Authentication\WebApplicationCredential.cs:line 455 at Microsoft.Health.HealthServiceRequest.Execute() in e:\bt\33\private\hv\prod\src\sdk\core\HealthServiceRequest.cs:line 157 at Microsoft.Health.PlatformPrimitives.HealthVaultPlatformItem.Execute(ApplicationConnection connection, HealthRecordAccessor accessor, HealthRecordSearcher searcher) in e:\bt\33\private\hv\prod\src\sdk\core\HealthVaultPlatformItem.cs:line 643 at Microsoft.Health.PlatformPrimitives.HealthVaultPlatformItem.GetMatchingItems(ApplicationConnection connection, HealthRecordAccessor accessor, HealthRecordSearcher searcher) in e:\bt\33\private\hv\prod\src\sdk\core\HealthVaultPlatformItem.cs:line 399 at Microsoft.Health.HealthVaultPlatform.GetMatchingItems(ApplicationConnection connection, HealthRecordAccessor accessor, HealthRecordSearcher searcher) in e:\bt\33\private\hv\prod\src\sdk\core\HealthVaultPlatform.cs:line 1628 at Microsoft.Health.HealthRecordSearcher.GetMatchingItems() in e:\bt\33\private\hv\prod\src\sdk\core\HealthRecordSearcher.cs:line 104 at _Default.GetSingleValue[T](Guid typeID) in c:\projects\Q-EMR\website\Default.aspx.cs:line 105 at _Default.Page_Load(Object sender, EventArgs e) in c:\projects\Q-EMR\website\Default.aspx.cs:line 41 Microsoft.Health.HealthServiceException :StatusCode = InvalidApp :StatusCodeId = 6 


    • Edited by dhirajcon Thursday, September 6, 2012 7:35 AM catch code not given
    Thursday, September 6, 2012 7:33 AM

All replies

  • This looks really odd.  At the top of your code, is this for debugging purposes?

    ApplicationInfo info = ApplicationConnection.GetApplicationInfo();                       
    AppName.Text += info.Name;
    AppId.Text += info.Id.ToString();
    string s = info.ActionUrl.Authority;

    And does this work fine? Assuming this works, it means your application exists.

    Later on, you eventually call  HealthRecordSearcher searcher = PersonInfo.SelectedRecord.CreateSearcher(); and then a GetMatchingItems call and that fails?

    So you have a valid PersonInfo.SelectedRecord, this is an online web application that a user has logged in to get to the site?

    Thursday, September 6, 2012 5:23 PM