I recently inherited am ASP.NET MVC website to hots on my server from a different team within the organization. The solution was built in VS 2012 and I am testing it in VS 2013 before I start hosting on the serer. There were a number of assembly dependency issues that I have fixed - I updated MVC in Nuget and also had to install and earlier version of EF (4.0.0.0) to get the solution to compile.
Now I am faced with another issue in the Web.Config file. The following screenshot presents the issue I am having:
There are only 3 scenarios that I can think of that is causing this which are the following:
1) Something happened when I updated MVC
2) Something happened when installed EF 4.0.0.0
3) The connection string to the old server is still in Web.Config
(the only reason I don't think this is the issue is because the
database it is calling is still in existance and the data is still
there)
I was hoping somebody with more experience with MVC and/or EF could help me troubleshoot this.
Related
Getting an error The name 'Url' does not exist in the current context error in asp.net whenever I open a .cshtml file in my web project.
I should note that I got this solution fresh from our source repo and other developers tell me they don't see this issue.
Web project has a referenced to a nuget package and when I look at System.Web.MVC it's Mvc.4.0.40804
Things I've tried based on posted solutions:
1) Unloaded project and deleted .user file and did a clean and rebuilt.
2) Deleted temp ASP files in the .net framework directory.
There are a lot of other solutions saying to move views or adding to web.config file, but if other developers using same solution aren't facing this - I'm thinking it's machine specific.
I don't see any reference errors in the web project.
When I installed VS2017, I just did the ASP.NET development. So, i have no gotten another version of MVC. Could it be that?
Thanks,
Brian
So I ended up modifying my VS2017 install and under ASP.NET and web development, I uninstalled that and reinstalled and made sure ASP.NET MVC 4 was checked off under Optional.
I just created a new web application (MVC 5.2.3) in Visual Studio 2015, and I regularly get errors like this on the HtmlHelpers:
I'm using .NET 4.6 (the default project was set to 4.5.2 originally, however I still had this issue with that default setting). I've looked at a bunch of similar questions on this site, and yet I haven't found a solution that consistently works. Any advice?
This sounds like a corrupted MEF cache to me. Different user, different MEF cache.
The PM of Razor Editing, Mads Kristensen, wrote an extension to make clearing the MEF cache simple. Try this: Clear MEF Component Cache.
You'll just have to restart VS after clearing; rebuilding the cache takes seconds, not minutes.
Please let us know if this solves the problem for you.
I was working on an ASP.NET MVC 4 in VS2013 and everything was fine, then I've uninstalled 2013 and installed 2015, I was able to open the project, build it and even run, everything works fine (run/debug). The problem is that all my views are covered in errors:
the name 'model\Scripts\Url...' does not exist in the current context
In addition, the .Where method of a list in the model shows an error as well as all the #Html helpers. I want to emphasize that the project still works w\o any problems so the issue is UI or package related. I tried to force uninstall\upgrade Microsoft.AspNet.MVC but the package manager console throws an error and rolls back the attempt. I can provide any necessary info if it helps, thank you in advance.
The newly released VS2015 IDE seems to no longer support MVC3/MVC4 projects, while it only supports the MVC5:
Unable to find MVC3 , MVC4, MVC5 projects (or) No information about supported MVC Framework versions
If there are strict requirements to convert any existing MVC3/4 solution to MVC5 (for VS 2015), you can proceed with the steps listed in the
How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2 guide.
Update 2016-05-03
It seems that after installing the VS 2015 SP2 update, it behaves much better. If you have a chance, I suggest that you upgrade your IDE and check if the issue goes away.
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.
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.