Value cannot be null. Parameter name: httpBrowserCapabilities - asp.net-mvc

I just created a new MVC application from VS 2015. Target framework is .NET 4.5.
In the first debug, it shows
Value cannot be null.
Parameter name: httpBrowserCapabilities
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: httpBrowserCapabilities
And the stacktrace points to: System.Web.HttpBrowserCapabilitiesWrapper..ctor(HttpBrowserCapabilities httpBrowserCapabilities) +3511141.
What could be wrong here? I reinstalled Visual Studio yesterday but it still won't fix. What can possibly break this httpBrowserCapabilities?
Reinstalled my Visual Studio, no fix.
The whole situation looks like what is described in these posts:
Webmatrix and iis 8. Default project doesn't not work
Webmatrix only error with ajaxtoolkit.
It just happened suddenly and there is just no way to fix!

It looks like some code somewhere is trying to use HttpBrowserCapabilities to do browser detection. Weird thing is that MVC does not use this at all, and in fact, the only usage of it I can find is in conjunction with Web Forms server controls. If this is truly just a scaffolded project, without any additions by you, then it's possible you chose the wrong project type (though I have no idea why any built-in project scaffold would throw exceptions by default).
Regardless, my best advice is to simply create a new solution, and make sure you choose "ASP.NET Web Application" as your project type.

This is only a makeshift.
I find I could use Local IIS instead of IIS Express to run the web applications.
So it appears something is wrong with the IIS Express. But a re-installation of Visual Studio won't fix it. Neither could a re-installation of .NET framework do.
Anyway, since I have a local IIS, I just change the Servers properties in the application's Properties, Web tab. Have to run Visual Studio as Administrator. And check Override application root URL.
So now I am back in working mode. I will look into how to fix IIS express later. If anyone has a better solution, please share with us. Thanks.

Related

How can I run an MVC app as a class library?

I've just started working on an MVC 4 app, using Visual Studio 2010, got the app building, but alas am still waiting to get admin rights to my Windows XP box.
...and I don't seem to have any way to run the app in my browser. The startup project is a class library, so I can't run it directly by F5ing, and I lack (probably due to not having admin access) the normal options to set the server configuration in the Debug panel in the project's properties.
So what's the best option for me, anyone? Or is this intractable without admin rights?
EDIT: With MVC, make sure the startup project type is Web Application, not Class Library. I forgot this! If you need to change, see this question. And the problem had nothing to do with not having admin rights.
Right click on the MVC project, Debug->Start New Instance
I am also facing the same issue.
I just modified the csproj file of that project.
I added
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
to the project.csproj file and reload the application and found my solution working at next moment.
With an MVC 2.0 project in VS 2010, the default (and only) output type is ClassLibrary. For me it turned out to be something really stupid. I had accidentally set another class library project in the solution as the StartUp Project. Right click your MVC project in Solution Explorer, and choose "Set as StartUp Project". It should appear bold in the Solution Explorer if it is the designated StartUp Project.

Debugging MVC application in VS2012 attempts to start IIS Express twice

UPDATE
I'm certain this is a Visual Studio bug with no obvious solution. I've encountered a number of people who have the same exact issue. I have submitted a bug ticket with Microsoft here:
http://connect.microsoft.com/VisualStudio/feedback/details/778864/vs2012-is-spawning-two-iisexpress-processes-when-attempting-to-debug
If you are having the same issue as described below, please go vote up the bug ticket so that it gets more attention.
Whenever I attempt to debug an MVC3 (or MVC4) application in Visual Studio 2012 configured to run on IIS express (version 8), I get the following error:
Here's the kicker: IIS Express is starting, even though Visual Studio doesn't think so and the debugger fails to attach. The IIS Express tray opens and I can clearly see all configured websites are started:
Oddly enough, the IIS Express System Tray reports that there were some errors when running IIS Express. Here's what it says:
This is a serious WTF. It's reporting that 8080 is being used by an IIS Express Process - the one that was just started by Visual Studio. So, Visual Studio is attempting to launch IIS twice, and when it predictably fails the second time, the debugger bails. I should note that before launching the debug configuration in Visual Studio, I made absolutely sure no IIS Express processes were already running. I used Process Monitor to verify that Visual Studio is in fact attempting to launch IIS Express twice:
Notice in the screen shot above you can clearly see websites running on IIS Express PID 4732. PID 4924 is the second failed attempt at launching IIS Express.
This issue was initially occurring on a Windows 7 installation. I reformatted completely, installed a fresh copy of VS2012, and got the same issue. I went a step further and reformatted, installed Windows 8 and a fresh copy of VS2012, and the issue persists.
I have created brand new blank MVC3 and MVC4 projects. Nothing fixes it.
I'm tearing out my hair here. Any help would be greatly appreciated.
w.Brian, I have followed this post since it's start and have had the exact same problem for quite a while now and I have just discovered what is causing the issue for me. I have been able to reproduce and fix the error for myself with this:
The reason VS2012 is starting iis express twice is related to being attached to a domain and being logged into a domain account. Once I logged into a completely local admin account I was able to launch and debug an MVC4 application without any issues. This is using Windows 8 Pro, VS2012 Update 1, attached to my domain, and no other software/extensions/configuration. Completely clean installation.
Hi maybe this solutions could help you.
Manage RuntimeVersion=”4.0″ to “4.0.30319″
Example:
<applicationPools>
<add name=”Clr4IntegratedAppPool” managedRuntimeVersion=”v4.0.30319″ managedPipelineMode=”Integrated” CLRConfigFile=”%IIS_USER_HOME%\config\aspnet.config” autoStart=”true” /><br/><br/>
reference:Issue: Visual Studio 2012 > “Unable to launch the IIS Express Web Server”
Use Process Monitor to solve the issue
reference: Debugging the “Unable to launch the IIS Express Web server.” error from Visual Studio 2012.
Try switching to the visual studio built in web host and run it. After you run it once you should be able to switch back to iis express
reference: from the forum Unable to launch the IIS Express Web server
try re-installing Visual Studio 2010 SP1, which contains iis-express.
disable the logging module by modifying the applicationhost.config, which is located in the %userprofile%\documents\IISexpress\config directory. To do so you will need to comment out a couple lines in the file.
Under the / element, comment out the line
<add name="HttpLoggingModule" image="%IIS_BIN%\loghttp.dll" />
Under the // element, comment out the line
<add name="HttpLoggingModule" lockItem="true" />
After saving your changes try restarting iis express.
reference: from stackoverflow forum: Unable to launch the IIS Express Web server
Right click you MVC project /*all of them one by one*/
go to properties
go to web tab
you must be having having checked "Use local IIS webserver" radio box
in the textbox below it make sure no to projects have the same port which in your case is 8080
Have a look at the answer here:
http://forums.asp.net/t/1953087.aspx?VS+2013+Unable+to+launch+the+IIS+Express+Web+Server
It was strange behavior on a Windows 8 machine when 'bg' was part of the username
I might be a little late to the party - here's my two pennies:
a) http://saintgimp.org/2012/05/03/fixing-the-error-unable-to-launch-the-iis-express-web-server-failed-to-register-url-access-is-denied/
b) http://abhijitjana.net/2010/07/20/unable-to-start-web-site-on-iis-process-can-not-access-the-file-because-its-being-used-by-another-process-how-to-resolve/
Synopsis: There is a URL reservation for the current port (usually Skype)
Just in case, do you have 127.0.0.1 localhost defined in folder/system32/drivers/stc/hosts ? Otherwize, you can check here, this might just be the key.
Cheers
I had the same issue on Windows 8 and Windows 8.1 using my domain account. In my case changing the Documents folder path (Right click on the Documents folder -> Properties -> Location) from C:\Users\username\Documents to D:\Documents helped
This week, I experienced this identical issue: IIS Express starts, but VS complains it couldn't start IIS Express and debugging fails.
I finally resolved the issue by applying the June 2014 hot-fix to IIS Express:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=43380
We (my IT support and I) found this hotfix after stumbling over and following a very unlikely problem. Apparently, MS verified a bug in IISExpress 8.0 which results in it misbehaving if any part of the application name contains the letter combination "bg" (my username begins with bg):
https://connect.microsoft.com/VisualStudio/feedback/details/848945/visual-studio-2012-iis-express-fails-to-start-if-application-name-contains-bg
Note: VS 2013 Update 4 already contains this fix, which may be why some people had success simply by updating to VS 2013.
Some other links we found concerning the issue (you may have to skim a bit to find the topic):
http://forums.asp.net/t/1953087.aspx?VS+2013+Unable+to+launch+the+IIS+Express+Web+Server
https://connect.microsoft.com/VisualStudio/feedback/details/865116/process-with-an-id-of-id-is-not-running
What worked in my situation was to unload the project, then to edit the csproj file. I removed all sections regarding IIS and IISEXPRESS. Then I reloaded the project and chose USE IIS EXPRESS from the project properties all over again. It then worked.
I ran into an identical issue today (IISExpress trying to start twice and failing when hitting Debug in Visual Studio) while helping another developer with a web forms site. After trying several solutions, we found that we could resolve the problem by:
Creating a new, empty Visual Studio solution
Adding an "Existing Website" pointing to a new, empty folder
Copying the contents of the existing (non-working) website into the new folder we created
Simply removing and re-adding the website to the original solution did not work, nor did creating a new solution and adding back the existing site. I can start IISExpress from the command line just fine.
After doing a before-and-after comparison of the .SLN files I believe that is where the problem lies. Since I had found a workaround I didn't spend a lot of extra time on it. Obviously recreating the entire solution from scratch may not be an option for larger projects (ours was a very small one) but hopefully this at least points in the right direction.
There are two instances of the site FrontEnd running of course, but notice that one instance is HTTP and the other HTTPS.
It's possible to get two instances when SSL Enabled is set to True in the web site properties but the Project Url on the Web tab is set to an HTTP address.
Make them both HTTP (or HTTPS) and that might fix it.

ASP.NET MVC3 not working in Windows 8

is there anything special I need to do to get ASP.NET MVC3 enabled on my Windows 8 Release Preview install? Creating even a blank ASP.Net MVC3 Razor application in VS2010, deploying to the local IIS instance as a new application, and loading the page in the browser doesn't work. I'm met with the following error:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
So I've then gone in to the new VS2010 project, right click, select "Add Deployable Dependencies" and selected "ASP.NET MVC" along with "ASP.NET Web Page with Razor syntax"
Then I re-deploy the project to local IIS application. No change. Still "web server not configured to list contents of the directory".
It's worth noting the VS 2010 Development Web Server works fine.
Any ideas?
Found it. Turns out even though I'm using ASP.NET MVC3 and had the .Net 4.0 framework installed, the Windows 8 "feature" for ASP.NET 4.5 needed to be installed for all this to wire up. Seems a bit counter-intuitive, but changing that did it.
You may want to consider running the MVC3 installer on your host machine so that all dependencies for MVC3 projects are stored in the GAC. If you need the install package you can download it from:
http://www.microsoft.com/web/gallery/install.aspx?appid=MVC3
I can't verify that this works on the Windows 8 preview, but it would be my first instinct upon running into your problem.
Did you ensure that the worker process for the site is configured for .NET 4?
When you say you "Deployed", how did you do that? It sounds like the folder is not being set to an application.
For me .NET 3.5 was not installed for IIS 8 in Windows features. Although I'm pretty sure my app is .NET 4.0... Worth trying though.
I had problems installing MVC3 MS VS 2010. Windows 8 x64. The platform installer shows no errors.
Root cause : aspnetwebpages.msi breaks updating web.config files. I updated two web.config files which appeared to only contain blanks.
Here are my directions:
Ensure C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config is valid. Use web.config.default, copy then rename to web.config to correct if it looks wrong.
Ensure C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config is valid. Use web.config.default, copy then rename to web.config to correct if it looks wrong.
I don't know why the files were bad in the first place.

Cannot create asp.net mvc view using visual studio 2010, please help

I am mvc 2 newbie. got this weird error message, couldn't figure out how to fix it.
I am using visual studio 2010 and my project is asp.net mvc 2 using .net 4.0
I right clicked inside the action method to generate the view. It kept giving me error message. I dont have that problem before, only happened in this project.
If it happens on everything, try reinstalling Visual Studio.
If it's a problem only with MVC Framework, try dwonloading it from here http://www.asp.net/mvc and install again. FileNotFoundException in the VS directory indicates that probably some required files are missing.
I assume Tut.Domain is something you have built? If so, you either are not building it, or it is not located in the correct location for the application to pick up. If you read the end of the error message, prior to stack trace, it mentions Tut.Domain, which is where your troubleshooting should begin.

ASP MVC 2 in server

I have built in visual studio a simple MVC 2, just to see if it work on the server where I'm hosting it. The server has .NET 3.5, that's why I'm using MVC 2 and not MVC 3.
I put the files of the project on the server, but I get this error: Runtime Error
Description: An application error occurred on the server.
I looked up this error already, I changed the config file, but I was wondering what other things do I have to do, like in visual studio. What are the steps to like wrap up the project and put it in the server?
Any help or useful links would be appreciated!
The first thing would be to make sure that you have ASP.NET MVC 2 installed on the server. If not you could do a bin-deployment. Also you might find the following article useful.
Generally, the steps are:
1) Compile your application in Visual Studio.
2) ???
3) Profit.
Seriously though, you haven't provided enough information to diagnose the problem.

Resources