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

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.

Related

Value cannot be null. Parameter name: httpBrowserCapabilities

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.

Getting Piranha CMS working with MVC

I'm quite interested in Piranha, but unfortunately getting it up and running following these instructions is frustrating.
When I follow these instructions (I tried 3 times) and run the site I just get "The resource cannot be found".
From the routing supplied it's clearly looking for /Home/Index, but that's not as part of the solution. I added the Home controller, but by itself it does nothing. Browsing to /Page/Index results in "The resource cannot be found" too.
I'm supposed to see an installation screen, but where is it?
I managed to reproduce the error when creating an new Web application > MVC > Empty in Visual Studio 2013. Creating an empty MVC application in Visual Studio 2012 does not produce the same result.
Opening the project created in VS2012 in VS2013, recompiling it and running it doesn't produce the same error so there's obviously something different in how the projects are created which I'll have to look into.
Can you confirm that you are using VS2013?

MVC 2 to MVC 3: MvcScaffolding fails due to "could not load file or assembly" error

Setup:
I am using MVC 3, EF 4.1, Visual Studio 2010 SP1 with Power Tools updated to latest version.
With the above installations, I don't need the NuGet packages that were required previously. Everything is RTM.
The project has been upgraded from MVC 2 to MVC 3. I initially tried the upgrade tool, but that gave me grief, so I did it manually as per the instructions in the MVC 3 Read Me file.
Problem:
When trying to use the new scaffolding of controllers and views for CRUD functionality (against Code First DbContext), the scaffolding fails with the error:
Could not load file or assembly 'file:///C:\[PATH TO MY APP]\bin\Lanap.BotDetect.dll'
or one of its dependencies. Operation is not supported.
(Exception from HRESULT: 0x80131515)
Question:
Lanap.BotDetect is a Captcha control. It works fine and is there, I use it in other pages no problems, the solution compiles, etc, etc. So there is no problem with this dll.
However, this error is stopping me using the new scaffolding capabilities.
I can't see what it has to do with the scaffolding of a new controller and its views, so there must be some configuration that is wrong.
Any suggestions as to where I can look? Googling has drawn a blank.
EDIT 1:
I am trying to see the failed assembly binding using Fusion Log as suggested in a comment. No failed binding showing (but that might be my fault) but the question remains:
Why would MvcScaffolding NEED to load the Captcha .dll at all? It is just scaffolding a controller, and nothing in the T4 says anything about this .dll
(NOTE: I haven't edited the scaffolding T4 code)
EDIT 2:
I tried removing the reference to Lanap.BotDetect, and the error changed to not being able to open the config file that has the connection strings (I shunt the connection strings out to a db.config string, just gives me less visual pain when looking at a config file).
I am giving up on scaffolding on this app. It works in clean, new apps, but not this one where there is a lot of pre existing code.
I found another solution to this. Turns the issue for me was that the issue was it was being built over a network drive. So when I moved the project over to a location local to my machine and rebuilt the project it corrected everything. I detailed everything with screen shots and here...
http://ryandunn.co/mvc-growing-pains-could-not-load-file-controller-dll
Put simply check the location of your project and move it to C: after that a quick rebuild had me back and working normally.
So I know that you have moved on but I ran into the same problem and just found the solution. It turns out the error is due to the assembly not being trusted i.e. you downloaded it from the internet.
You can right click the .dll and unblock it to fix the problem. For info on how to unblock see the following
http://blogs.msdn.com/b/brada/archive/2009/12/11/visual-studio-project-sample-loading-error-assembly-could-not-be-loaded-and-will-be-ignored-could-not-load-file-or-assembly-or-one-of-its-dependencies-operation-is-not-supported-exception-from-hresult-0x80131515.aspx

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.

How to fix the error 'System.Web.Mvc.Controller' is not defined

I started out this morning working with my ASP.NET MVC project like normal and everything worked. I added a new class and some functions and it still worked. Then, all of a sudden, while I was working with a javascript file, I started getting these not defined errors on the MVC classes/functions. There are 118 of them in the project and I'm not sure how to fix them.
I've tried restarting Visual Studio and rebooting the computer. I've also tried loading another MVC project to see if the framework might be hosed, and it works fine. I've checked the references and the ASP.NET MVC 1.0 RC2 dll is there.
Has anyone else ran into this problem?
Please help!
I figured it out. I had added a new Master page to the project, but when did so, I had chosen a regular Master Page not the MVC Master Page. What threw me was that I was able to build the program a couple times and run it after I had done this without seeing any errors.

Resources