HttpHandler in IIS7 and Visual Studio 2010 - visual-studio-2010

I'm trying to run an httphandler (ashx) in a asp.net 4 website.
When I call it from Visual Studio integrated server, it returns a 404 error.
It works if I call it on the site configured into the local IIS.
Someone could help?

Are you using ASP.NET MVC, or System.Web.Routing?
Do you have something like
routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
in your RegisterRoutes() function in your HttpApplication instance?
One thing to keep in mind is that the Visual Studio server thingie runs all requests through the managed pipeline.
Is the httpHandler added to the system.web section of the Web.config file? (In IIS7, this goes under the system.webServer section, but I am not sure if newer versions of Cassini will look there.)

Related

Visual Studio 2010 change from localhost to full computer name/domain

I am using Visual Studio 2010 and I would like change debugging environment from the localhost to my full computer name/domain. Does anyone have some step by step instructions on how to do this? (I would also like to set it up as the default for all new projects plus how to change it in existing projects). I am new to using visual studio and programming in general.
I found this post Visual Studio 2010 - Change localhost to custom domain in the forum but it wasn't clear to me on how to make the change. I went to the project properties web tab and attempted to set up local IIS Web server but got the following error:
"ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly."
I am not ever sure if that was the correct way of going about doing this. I just need my debug url address to go from:
"http://localhost:53674/Projectname.aspx"
to:
"http://computername.pag-domain.webname.org/Projectname.aspx"
Thanks!
For fixing the iis web server, I am not really sure what was done...our IT department worked on that. For setting up the local IIS webserver in visual studio I did the following: In the web project properties, under the web tab, I choose "Use Local IIS Web server, in the project URL, I put the full computer domain and told it to create a virtual directory.
Got it. Our IT came to the rescue — he fixed some issues with the ASP.NET not accessing 4.0 correctly. Then I set up the "Use Local IIS Web server" correctly and it worked like a charm.

VS 2010 Intellisense WebAPI Webforms

I have added WebApi nuget package and a few api controllers to an existing Webforms project, however intellisense isn't working on any of the controllers and I can't use F12 to go to a definition.
CodeRush is working fine and I have ran Devenv /resetuserdata in case it was a VS thing but I suspect it is to do with WebAPI code.
Both Intellisense & Go to Definition are working perfectly fine here with Web API RC and ReSharper. Try adding the packages to an empty Web project via NuGet and see if it works that way. If not, there is a problem with your installation (or CodeRush for that matter).

publish MVC 3 app to localhost IIS 7

I have searched a lot and I have tried but couldn't published asp.net mvc 3 application on localhost. I have never tried before. I have currently adminpanel application running on development server of the visual studio. In my machine, following are installed:
IIS 7
windows 7
SQL server 2008
MVC 3
asp.net 4
In visual studio, I publish application using File System publish method and target path to C:\inetpub\wwwroot\adminpanel. And Following Directory and files were copied.
Directory
App_Data
bin
Content
Scripts
Views
Visual Studio 2010
Files
Global.asa
Packages.xml
Web.xml
I don't know but I think Some directory's are missing like the controllers, Helpers, Models, Sources which I have seen in Visual Studio Solution Explorer. When I browse to http://localhost/adminpanel, it shows all directory and files list in browser.
How to publish the application to IIS and use SQL server of local machine so that I can browse to particular controller like http://localhost/User/UserManager which I can do in the dedicated server of the visual studio.
I don't know but I think Some directory are missing like controllers,
Helpers, Models, Source which I have seen in Visual Studio Solution
Explorer.
That's perfectly normal. ASP.NET MVC 3 uses an ASP.NET application type (in contrast to ASP.NET WebSite) meaning that it is precompiled and all the source code is removed when deploying. Only the Views, Static resources such as CSS, Images and Scripts as well as the bin folder containing the compiled assemblies is deployed.
Basically, I think your Site has not been defined as a application in the IIS. You can do it from IIS manager.
But, instead, when you publish the the application, select File System but instead of browsing to the mentioned Folder, in Target Location field click the button next to the text box and select Local IIS on the left side. Now you can create a Application Folder and directly publish into it.

ASP.NET configuration using cassini instead of IISExpress

I have an ASPNET MVC application that I have configured to use IISExpress.
If I go to Project --> ASP.NET configuration, Visual Studio seems to fire up Casssini anyways for the admin configuration pages. Is there a way to change this to use IISExpress
Typically, this happens when you have more than one website project in your solution. Is that the case here? If so, you have to set IISExpress as the server for all projects.

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