ASP.NET Empty Web Applcation for F# - asp.net

Does anyone know if there are web templates for F#? Specifically, the ASP.NET Empty Web Application. I am looking for VS2012.

Actually, this is not exactly what I need to create a F# Web Applcation - I don't want any C# at all. I went and added this line to the .fsproj file like this:
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21}</ProjectTypeGuids>
But I get this when I try and load the project:
error : Specified method is not supported.
I guess FSharp can't be used for a web application? How lame is that?

Never mind - found it on the Online Templates under Visual F#.
Thanks

Related

Named Pipes references not working with ASP.NET MVC 4

I'm working on a API and using ASP.NET Web API in order to expose it. I tried to add a service reference to a Named Piped service that is responsible for authentication and authorization, but I couldn't reference it on my code.
That Named Pipe service is working properly and is used on a wide variety of projects. That is the first time we try to use it with ASP.NET MVC 4. It's working very well on another project that uses ASP.NET MVC 3.
Like you could see on the following image, I'm able to add the service reference. But It didn't appear on Object Browser or auto-complete!
When I try to invoke that service, it just does not show up anywhere.
It appears to be a problem with ASP.NET MVC 4 projects and Named Pipes service references.
I really don't know if that is a well know / documented behavior, but I wasn't able to find anything useful related to that question on the internet.
I could add a reference to that service using Visual Studio 2012 on any kind of project, except ASP.NET MVC 4 ones. The problem is specifically related to ASP.NET MVC 4 projects.
I tried to add the reference using Visual Studio 2010 and I had the same problem: working pretty well with ASP.NET MVC 3 and any other kind of project. Again, the problem is specifically related to ASP.NET MVC 4 projects.
Is anyone having the same problem? How could I go through it?
Since it appears to be a Visual Studio / ASP.NET MVC bug I just found an workaround.
I just figure out that I could use svcutil command line tool in order to generate the code for service client and data structures. Here are the syntax for the command:
> svcutil net.pipe://my_sevice/mex /namespace:"*, MyNamespace"
It generated the following files:
SecurityService.cs
output.config
Then I just imported the generated SecurityService.cs file into my current project and did a merge of the binding configurations available on the generated output.config with my own web.config.

Visual Studio 2010: convert website project to web application project?

I have an existing solution in VS2010. When I click the properties of my project I get the view as can be seen in image1.png:
When I create a new empty ASP.NET web application and click the properties of my project I get the view as can be seen in image2.png:
A huge difference.
Now I'm implementing this code here: http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api
And that tutorial assumes I get a view as I've shown you in image2.png
In image1 and image2 I've also marked the menu items: "Website" and "Project"
This makes me assume that I've created a website application whereas I need something different (I'm thinking a web application project).
Not sure what to do now, I need to convert my current application to another thing, but to which type and how to do it?
I also came accoss this post: http://blogs.msdn.com/b/webdevtools/archive/2009/10/29/converting-a-web-site-project-to-a-web-application-project.aspx
But before I start screwing up everything :P Is that what would solve my problem?
It should be possible to use either a web site or a web application project. In the example on the link you've posted, they use the predefined template for ASP.Net MVC Web Applications. This has several advantages - it sets up the structure and other resources for you - it's effectively a template.
For the purposes of the tutorial, why don't you just set up an application that way? If you've already written some code, you can just import it into the new application.
For future projects, you might want to consider which is best for your needs. Apart from structure, there are some other key differences between a web application and a web site project.
MSDN handily provides the differences here:
http://msdn.microsoft.com/en-us/library/dd547590.aspx
If you find you want the features of the web application, then the link you've posted is fine. You'll need to do some re-organizing of your references and so on and so forth, but the process is fairly straightforward (but not painless).
A "web site" in visual studio is the old, .net 1 style of creating web sites. It basically dynamically compiles the code in a folder when it's hit for the first time. Later .NET introduced a "web application" model where the code is compiled into a DLL and no code files are deployed with the site. "Web sites" are pretty much depcrated and shouldn't be used for any new projects unless you're doing a quick demo site.
The codeplex project you referenced also depends on MVC 3 (which are web applications).
You are probably better off just restarting like the tutorial says - create a new MVC application like it shows in its first screenshot.
If you do not have that option, use Web Platform Installer to add MVC for you - http://www.microsoft.com/web/downloads/platform.aspx
Good luck!
I can't tell exactly what's going on from your screenshots, but if you have a web site that you need to convert to a web application project, you can find the directions here
Although the instructions are specific to VS2005, they are basically the same for 2010 as well.

invalid resx file. Could not find file ..\..\My Project\Resources.resx

I was working with a web project in the .NET 2.0 Framework, but when i open the project in the 4.0 Framework it gives me invalid resx file error. The way my project works is that i have an empty solution, then i add a project, then a website. So it is a solution with two projects in it, one with the VB script, the other with the aspx pages
If you use IIS you might have forgotten to edit the framework in the settings.
if you moved it its just the filepath that is invalid. try to use Utility.RawApplicationPath and then you just go from there.
Utility.RawApplicationPath"/myResourceFolder/myResources.resx"
I use my resources like that and I never had any problems ;)
Hope this helped you.

ASP.NET MVC alongside Web Forms in the same web app?

Has anyone successfully deployed ASP.NET MVC alongside Web Forms in the same application in a production environment? Were there any conflicts or gotchas you faced while doing so?
Is it really as easy as shown here in practice? What about if you run a MVC using the Razor view engine alongside Web Forms?
Mvc is build on top of asp.net as is webforms, so yes it's easy.
Done it couple of times for conversion purposes
Maybe this url's could help you:
http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx
and
http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx
One gotcha is don't put your WebForms inside the Views folder. I haven't get figured how to make MVC leave those paths alone. None of the ignore routing instructions seems to work in this case and the WebForms throw 404s.
Other than that WebForms works perfectly fine alongside MVC since MVC2.
Has anyone successfully deployed ASP.NET MVC alongside Web Forms in
the same application in a production environment?
I never mixed ASP.NET MVC and classic WebForms in the same application. I make them run in separate applications and communicate between them with standard HTTP techniques (query string parameters, form posts, cookies, ...).
Is it really as easy as shown here in practice?
Yes, it is as easy as that.
Check out scott hanselmans AddMvc3ToWebForms nuget package. I am using it and its working pretty great. I am using it to gradually convert my web forms app to mvc
I've spent a lot of time over the past few months on this. Here are my observations.
The good/easy
- Getting Webforms to call into MVC controllers
- It was remarkably easy to stand up a new MVC3 project and drop Webforms pages into it.
- I was able to move my <pages><controls></controls></pages> section into the /pages directory in a new web.config there
The dirty/difficult
Regarding the GUID
Please note that the GUID has to be added at the front of the line for some reason... everytime I tried it failed. Until I stumbled on a post that insisted it be the before the others.
also I don't know what the difference is but I have a different GUID working... {E53F8FEA-EAE0-44A6-8774-FFD645390401}
getting the landing page to be Webforms caused ALL kinds of snags.
getting jQuery intellisense to play nicely with T4MVC
this is what I did to address that
#if (System.Diagnostics.Debugger.IsAttached)
{
<script src="../../Scripts/Mvc3/jquery-1.7-vsdoc.js" type="text/javascript"></script> #* intellisense! *#
#Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_1_7_js)
#Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_unobtrusive_ajax_js)
}
else
{
#Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_1_7_min_js)
#Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_unobtrusive_ajax_min_js)
}
Recommendations:
Use T4MVC in ALL cases even if you are pure webforms. The elimination of magic strings for static content (.js,.css, images, specifying templates) is outstanding.
and if you have any part of your build process compiling views then you get compile-time safety on any of those links.

How to get asp.net website product name and version?

Hopefully this is an easy one - though I don't seem to have much luck Googling the following:
Usually in an ASP.NET Web Application I would write - My.Application.Info.ProductName or My.Application.Info.Version, but I'm looking at an older ASP.NET Web Site and it doesn't have the Application option.
Does anyone know the equivalents?
I asked a similar question:
How should I version an ASP.NET Web Site project?
My solution was to use the assembly version of an assembly I included with my web site.
Do you mean the name as stated in the AssemblyInfo-file? In that case you can get the name by
System.Reflection.Assembly.GetExecutingAssembly().GetName()

Resources