Basic Project Template for Asp.net Web Api? - asp.net-web-api

I am wondering if there is a "basic" asp.net web api template. I only see one "web api" project and it brings out of bit of stuff in and not sure if all of it I need.

You can either:
1) Create a new MVC4 project > choose Web API template - but that, as you point out, brings in a lot of stuff, including Modernizer, jQuery, Knockout and so on
2) Create a new ASP.NET empty Web application and install Web API web host from Nuget:
PM> Install-Package Microsoft.AspNet.WebApi
You then end up with a very clean, basic project, including only the necessary DLLs.
3) If you want to self host Web API (not do an ASP.NET MVC4 project), you can create a new console application and install Web API self host from Nuget:
PM> Install-Package Microsoft.AspNet.WebApi.SelfHost
which is perfect for lightweight services, but obviously you don't host inside IIS anymore so there are additional release/deployment considerations. You can read more about self host here -> http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api

For Mvc 5 in VS 2015, I select empty project template and check WebApi section. It give me clean project with just WebApi references installed.

My suggestion goes for Empty ASP.NET Web API Project Template, which is a VS extension.
There is a pretty good demonstration of it in this Code Project article.
I use it without any sort of problems and it really is lighter than default WebAPI template.

Related

How to create the asp.net web setup project

I have a Asp.net application which I want to make it easy to depoly in client machine by click the .ext or .msi file.
Then I found the "web setup project" in vs.
However I have no idea how to make it.
In my case,my application need .Net 4.
And after the app is deployed I have to modify something in the web.config which I want to gather through the install wizard.
Also I need to do some clean work after deploy(modify some files).
So I wonder if my requirement is possible using "web setup project",and how to make it?
In Visual Studio you can modify files during install only through custom actions. So you will need to write custom code which does what you need. Regarding .NET Framework 4, it can be added as a prerequisite.
If you want an easier solution, you can try a commercial setup authoring tool: http://en.wikipedia.org/wiki/List_of_installation_software
For example, Advanced Installer has a dedicated project type for ASP.NET applications.
Yes,We can make Custom Actions(Framing Connection during installation ,Consuming WCF service for Web App)to .msi file during installation.
If you want to have more clear picture about this refer my articles.
This is to create or change Connection string along with setup creation for Windows Application
http://www.codeproject.com/Tips/446121/Adding-connection-String-During-Installation
In this creating setup file for Web App which consumes WCF service
http://www.codeproject.com/Tips/477202/SetUp-file-Creation-for-Web-Application-which-Cons

How to set up a Single-Page Application in Visual Studio 2010

I've read about Single-Page Applications recently and wanted to try one out. After watching Steve Sanderson's presentation (http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2159) I wanted to create a Single-Page App in my Visual Studio 2010 and test it out myself. But then I found out I can't choose an SPA template anymore, as it was removed in RC version.
Now, the question is - what should I do in Visual Studio 2010 (with MVC4 installed) to be able to create an SPA? I'd like to use KnockoutJS for UI and Upshot for data, both of which I'm able to install using Nuget. I haven't found anything relevant on the Web, every single page I've been to is telling me to use the SPA template, which has been removed since.
Thanks for any suggestion!
SPA was excluded from RC because it wasn't ready in time for MVC4 release. Official ASP.NET SPA page. You can create project with MVC template and scaffold SPA via NuGet (SPA scaffolding)
For Visual Studio 2010, try using Hot Towel by John Papa.
Create an empty MVC4 app, then install a Nuget from Package Manager Console
PM> Install-Package HotTowel

How to publish my MVC 3 web application onto IIS7

if possible I need total from the beginning utter beginner advice on how to get my ASP.Net MVC 3 Razor Visual Studio 10 web application live onto my IIS 7 webserver please?
I've never tried to publish this before, and wondering what I'm missing?
I've clicked "Publish" on Visual Studio Express 10, created a "published" version of the website. I've uploaded it to my webserver, however can't make it load on the net?
Appreciate some guidance please? (not sure how / what default documents work etc...?)
By far the easiest approach is to use Web Application Deployment.
This blog by Scott Gu gives a great intro
http://weblogs.asp.net/scottgu/archive/2010/07/29/vs-2010-web-deployment.aspx
The article talks about web.config transformations (ability to have a .Release and a .Debug version of your web.config). Later, that capability was generalized through an add-on package to work for any XML-structured file in your deployment (for example, I use it with NLog configuration files).
http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx

How to Deploy Asp.net MVC3 Application to the Hosting (Web hosting Providers)

I am trying deploy my asp.net mvc3 application,
here it is what i done
1. I registered a free domain for asp.net in (somee.com)
2. n i uploaded all project files to the server through (FTP FileZilla)
3. I added all Refernec also of Asp.net mvc3 (System.web.MVC, mvchelper, n all other assemblies also i added )
but when i run the application from internet http://imgur.com/OMoZT this error occurs (IIS 7.5 Error)
please can u tell me how to deploy , step by step, as i am beginner really need help to learn the beauty of this language also how to include EF4.1 codefirst thing . From basic step to end please tell me .
The error looks like it could be due to the wrong framework being set for IIS within somee.com. I've never used them but there is likely to be an option somewhere in their dashboard. Make sure this is set to use .Net Framework 4.
If you are still having problems, try following Phil Haack's blog post on bin deploying.
http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx
Then in Visual Studio, you can right click on the project and select Publish... From there you can select the FTP option.
When your hosting provider creates the website in IIS, he has to choose the .net framework target version.
If you publish the solution using a different framework version it will generate an error.

ASP.NET 4.0 app mapped through virtual folder on SharePoint 2010

I'm considering publishing an an ASP.NET MVC 3 app under a SharePoint 2010 application on IIS (not inside SharePoint as a SPSite or whatnot, just a regular IIS application for SSO-integration w. SP).
The MVC app would then only inherit some configs. It has no reference to SharePoint and SharePoint does not have any reference to it other than it being an sub application under the SharePoint 2010 app in IIS.
3-fold question:
Is it possible?
Are there any obvious issues with SharePoint 2010 running on 3.5, and my new app running on 4.0 for instance? Sufficient to use different app-pools?
I'm concerned about the inheritance of web.configs between my MVC app to SharePoint's
web.config. Are there any issues regarding web.config inheritance between these two?
UPDATE (February 27, 2013): We no longer need to use <location> XML element to stop inheritance from SharePoint to the ASP.Net MVC 3 application. We need to give FullTrust to the ASP.Net application using the <trust level="Full" originUrl="" /> XML element in the Web.Config.
Some HTTP Modules / HTTP Handlers need to be disabled from the ASP.Net MVC 3 application.
For the SharePoint 2010 scenario, I also had to move the <sectionGroup name="system.web.extensions"> XML element from the SharePoint 2010 web.config file to C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config file because it conflicted with .NET 4.0. If you move it there, it will still be inherited by SharePoint web.config.
Anyway, I won't repeat all steps here.
Please see my blog post:
MVC 3 with SharePoint Server 2010:
http://samsonfr.wordpress.com/2013/02/26/recette-amliore-intgrer-une-application-asp-net-mvc-3-sous-un-site-web-iis-hbergeant-sharepoint-server-2010/
MVC 3 with WSS 3.0:
http://samsonfr.wordpress.com/2013/02/26/recette-amliore-intgrer-une-application-asp-net-mvc-sous-un-site-web-iis-hbergeant-wss-3-0-sharepoint-2007/
It's in french but I guess you can use Google translate.
Best regards,
I have tried and failed. Currently having to host the .Net 4 app on a seperate IP, which creates all kinds of cross scripting/security issues. I found some tips here: http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes but couldn't get it working.
If your application will run only under Virtual folder (so it will have access to SPContext if it needs to) an not an actually under Application folder (hence not being integrated into Sharepoint at all) then I guess Asp.net MVC 3 is out of the question because of its .net 4 relation.
But. Asp.net MVC 2 is definitelly possible. I'm developing such an app and it works as expected. It took me a while to integrate it though... My integration makes it possible to only change root Sharepoint's site web.config (only add new things to it, nothing's been taken out or changed). I haven't changes even the Global.asax for routing definition.
My application is running as a virtual folder under Sharepoint Foundation 2010 Site and has access to SPContext and is also security controlled by Sharepoint (authentication is performed by the SP 2010 Site). So that's definitely possible.
But it has to be Asp.net MVC 2 since it runs on .net 3.5, the same as as Sharepoint 2010.

Resources