Accessing secure web services – invalid certificate errors

Calling a secure web service from within an ASP.NET application was generating the following exception:

The remote certificate is invalid according to the validation procedure.

Digging further down into the exception provided a little more detail:

Could not establish trust relationship for the SSL/TLS secure channel with authority 'companyaddress.com'

But, this still didn’t give me too many clues as to the problem. I then came across this very useful MSDN blog post that gave me some very valuable steps to follow to resolve the issue. My first problem was that there were a couple of intermediate certificates involved that needed to be installed to the relevant locations on the server where my ASP.NET app was running; but this didn’t solve the problem so I set up the tracing file and ran the request again. This time the error was a bit more helpful:

Certificate name mismatch

It turns out that my problem was the endpoint address in my web.config file did not match the address in the certificate. My endpoint address was entered as companyaddress.com but the certificate was issued to www.companyaddress.com. The final part of the solution was to change the endpoint address in the web.config to match that in the certificate.

Xamarin Studio – Issues generating the initial project structure

There seemed to be a small bug in the version of Xamarin Studio where it would fail to create an Android Xamarin.Forms project correctly. When I tried to build the project I got an error “The type or namespace ‘Xamarin’ could not be found”. The issue was reported on the Xamarin forum as well.

It appears that for some reason the Xamarin.Forms package did not download correctly when the project was created. To solve the problem was fairly straight forward as I just needed to grab the Xamarin.Forms package from NuGet, which also pulled down the necessary dependencies for the project.

With the relevant assembly now referenced in the project the project would now build successfully.

Xamarin Studio – Java.exe exited with code 1 (MSB6006)

I have been started my adventure down the Xamarin road using Xamarin Forms within Xamarin Studio (v5.2.1) to generate an Android application. One of the initial problems I came across when generating my Hello.Android app was during the build process; I would get the following error:

Java.exe exited with code 1 (MSB6006)

It turns out that you need to allocate an amount of memory to the Java Heap within the Project Options. Under the Build section, select the Android Build option, click on the Advanced tab. The suggested minimum is 512 megabytes (this needs to be entered as 512M), but I gave mine 1 gigabyte (1G).