Thank you for sharing your stack trace. The issue that you mentioned could be caused because the current principal with which you are trying to create the product types does not have proper rights for this action. What you can do is either log in with user that has these permissions and try to execute the code again, or elevate the security context and skip the security checks of the provider with the following:
//Create the product type here
Thank you for the reply. I have traced it down to the server having not completed the start-up before my tests ran.