Microsoft digs lots of pits, and I keep jumping among them.
Recently, I wrote a program using HttpClient in dotNet to post some data to server through HTTP Post. The server is set with client certificate required.
My designing is simple:
Open X509Store to query the certificate by using thumbprint.
Attach the certificate found in step 1 into WebRequestHandler.
Pass the handler created in step 2 to the instance of HttpClient and send the request.
Required by step 1, I need to type the thumbprint of the certificate into code. The steps I did:
Open certificate from Windows. It’s shown up like this:
Copy the text of Thumbprint and paste it into a notepad.
Replace all spaces to nothing.
Copy the new text into code.
When I run the code, it ended in a strange way. No certificate is found by using the thumbprint I provided. I dig a long time before I found this pit prepared by Microsoft: The text, copied from the window above (in step 1), contains hidden lead bytes “0x200E”. These bytes won’t display in code view of Visual Studio, nor in Notepad.
While I’m trying to deploy my site from Visual Studio to a Windows Server 2012 R2 instance, I have to dig a lot for troubleshooting about Web Deploy related problems.
Here are some not listed in Microsoft documents:
Visual Studio need both Web Deploy (Web Deployment Agent Service, MsDepSvc) and Web Management Service (WMSVC).
You cannot install Web Management Service separately.
The easy way to install the both is choose “Web Deploy 3.6 for Hosting Servers” Web Platform Installer.
If you selected “Web Deploy 3.6” in another release, without “for Hosting Servers”, Web Management Service will not be installed.
If you leave Web Deploy installed without Web Management Service, you could add it by install “Web Deploy 3.6 for Hosting Servers” but IT WILL NEVER WORK! You have to UNINSTALL existed Web Deploy first and then reinstall the “Web Deploy 3.6 for Hosting Servers”.
SignalR 2.2.0 and jQuery 2.2.3 are selected;
Connect SignalR at beginning;
When SignalR disconnected, reconnect;
When SignalR event raised, call one method to pull the data from URL specified and set as content of a div; and,
Call the method mentioned above at beginning to load the initialization data.
Then, I need to do the same thing in one Raspberry Pi 3. I choose Windows IoT with UWP to build the basis. UWP app is quite easy, only one WebView control is embedded with the starting URL set to the page of that ASP.net website. According to only Insider Preview version can support Raspberry Pi 3, build 14295 is selected, which is the latest one can be found from official site.
After this app deployed and started in Raspberry Pi 3, it acts quite different. The initialization data is shown without any problem. But no more SignalR event is proceeded. By debugging on the server side, SignalR OnConnected, OnDisconnected and OnReconnected are called repeatedly and frequently.
Due to no more information can be grabbed from app running in Raspberry Pi 3, I have no clue at first. The good thing is I made a similar solution before. The only difference between these 2 apps, is the previous one use iframe instead of div. Despite of no reason observed, after I change the div into iframe and make the data surrounded by html and body tags which filling div previously , the problem vanishes away.