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.
I have multiple devices installed with Ubuntu Server. Some of them have a strange problem:
They can access internet using some applications, such as squid, without any problem.
They can ping to internet IP address.
They can use host / dig to query IP by domain name.
They cannot ping to internet by using domain name directly.
They cannot download file through wget / curl using domain name, but can do with IP.
They cannot use apt, stuck at connecting.
All they use a local dnsmasq as their dns.
After a long time dig, I found the problem and here is the fix.
open the file /etc/nsswitch.conf, search the line with “hosts:” and change the setting to “files dns” (without quotes).
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”.
Microsoft launched KB3194721 (for SqlServer 2012) and KB3194718 (for SqlServer 2014) this month though WSUS channel. If you choose to deploy them though WSUS, just as I did, you may face a bug on a cluster based SqlServer.
On the server with SqlServer installed as cluster, these patches just act as cancelled or failed. For digging the problem, I download the package from Microsoft Download Site and try to install them manually. The first step is decompressing. Files are placed on the largest drive (I dunno it based on the total or free space). In my case, one disk drive for a database role is chosen. Then the upgrading procedure starts, with a bug that is:
If the owner of this instance role of cluster is the same computer, the role will be automatically stopped during update process, and will be started later. But while the role is set to stop, the disk drive is offline with it. So, if that drive is the largest, sadly, the update procedure fails — source files of update package are missing.
Even you run these packages manually, not from WSUS, it’s still not possible to choose the folder to decompress. If some drive of database role of cluster is larger than all server self-owned disks, you may want to STOP THE NODE in cluster as a workaround.