Reputation: 3792
I'm not sure if this is F# specific or something else, but what could cause the following error message when trying to debug locally an Azure cloud service:
The Web Role in question doesn't seem to be a web application type project.
I added an empty F# web api Project to a solution (which adds Global.asax etc., I added an OWIN startup class Startup etc.) and then from an existing cloud service project I picked Roles
and chose Add -> Web Role Project in solution
, which finds the F# web project (its project type guids are 349C5851-65DF-11DA-9384-00065B846F21
and F2A71F9B-5D33-465A-A702-920D77279786
), of which the first one seem to be exactly the GUID that defines a web application type.
However, when I try to start the cloud project locally, I get the aforementioned error message. I have a C# Web Role project that will start when I remove the F# project. I also have F# worker role projects that start with the C# web role project if I remove this F# web role project. If I set the F# web project as a startup project, it starts and runs as one would expect, normally.
Now, it makes me wonder if this is something with F# or could this error message appears inC# too, but I didn't find anything on Google. Can anyone shed light into this?
<edit: Additionally, in the F# trying to open Package/Publish Web
tab in project settings will give the following error message
An error occurred trying to load the page. Specified cast is not valid.
I suspect this doesn't matter and may be just a bug in how VS handles the project or in F# MVC 5 template.
<edit for a solution of sort:
It looks like a solution to create e Web Role as a C# project and then include the web projects as ordinary F# projects works. A caveat here is that during this time the F# Web API template was updated. As of now, I used Web API 2.2 and Katana 3.0 from the 1.13 version of F# MVC template. As a bonus amongst many things, it looks this model has the added benefit of reduced deployment package size as blogged by Olaf Loogman at Reducing the size of an Azure Web Role deployment package.
Rather straightforward instructions for publishing multiple sites for one role can be had from Tips for Publishing Multiple Sites in a Web Role.
Upvotes: 2
Views: 407
Reputation: 3512
The specified cast not valid error happens with older versions of F# tooling. 3.1.2 should fix that issue.
I personally have created standard worker roles projects without a problem, and f# websites hosted in azure, but not f# web roles - I suspect that the support for them isn't great. Out of curiosity, why are you using a web role rather than a website project?
Upvotes: 3