Thursday, March 28, 2019

how to solve Infopath design cannot open an Infopath form required full trust

i was asked to edit a InfoPath form. however I always receive the following popup message



complaining that the template is not full trust. you must install the server certifcate etc.. actually this message is quite misleading. the root cause of this issue is that if you do not launch InfoPath Designer with Run as Administrator option

Wednesday, March 27, 2019

How to use Postman to call API( Azure Web API)?

it is not a rocket science to setup the postman. but it is a good practice to learn how to do it. since it is very useful for web api testing against the API hosting in the cloud.


       First set up the token generator request
  •        change the Method to Post
 
  •        click on the Body tab, click on click on the bulk edit

  •        paste the following setting to the text area
   
         grant_type:client_credentials
         resource:https://webAPIHostServer
         client_id:web_Api_Client ID
         client_secret:web_API_Client Secrete


       Second set up content query request
     we have to change to Method call to be GET.
     we only has to setup the header section
        Authorization:Token generate from the token generator
        Ocp-Apim-Subscription-Key: the key from the cloud


      Third set up the action query request
     we need to setup both the header and the body section
   
in the header section, we only have to copy from search query setup.

then in the body section, Post the JSon Data in the text area and select JSON(application/json) for data format



now we can have a Postman Ready for web api query and testing.

how to fix a console app implemented with lower version .net framework cannot comsume a web api developed with higher version of .net host in the Azure?

currently we have app implmented with a .net framework 4.5, it is running fine in the local desktop during the development. however the exceptions had thrown after it deployed to the host server.

"System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred.
  Source=mscorlib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at DealerETL.Program.Main(String[] args)

Inner Exception 1:
CommunicationException: An error occurred while receiving the HTTP response to http://dax:8080/MicrosoftDynamicsAXAif60/SubDealerQRService/xppservice.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Inner Exception 2:
WebException: The underlying connection was closed: An unexpected error occurred on a receive.

Inner Exception 3:
IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Inner Exception 4:
SocketException: An existing connection was forcibly closed by the remote host
"

the root cause of this issue stems from the Web Api had been implemented with higher version of .net framework 4.6.2 and the console had been implemented with .net framwork 4.5.

by default the security protocol had been set to the Tls which has value 192.


namespace System.Net
{
    [System.Flags]
    public enum SecurityProtocolType
    {
       Ssl3 = 48,
       Tls = 192,
       Tls11 = 768,
       Tls12 = 3072,
    }
}

after we manually set the security protocol in the code. the issue is fixed.

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072 |(SecurityProtocolType)768;