MVC 3 Views not deployed - asp.net-mvc

I have been working on a small project on recent delived ASP.NET MVC 3 RC. The issue is that when I try to deploy my website via File System, certain views of my website are not deployed. The site gives me error when i copy same deployed site to my hosting. When I manually copy views to hosting, it works ok.
Now this thing is not breaking anything as such, just want to know that if I am missing something while deploying my site. I am not sure why few views are deployed and why not others. Seems very random to me.
Thanks,

If you created the app before RC (aka using our Beta) we had a bug in which we didn't mark the views as "Content". New apps using the RC have this bug fixed, but if you open an existing project, it doesn't automatically fix up the existing files.
To fix them, select the file and in the properties pane, set the Build Output to "Content".

Related

ASP.NEt MVC edit files on server after deploying

I deployed my site on IIS 7. Can I edit c# files after deploying? In my sites's directory I see only .cstml files (Views), but there are no c# files... How can I do some changes in code without full redeploying? Thank!
Your project is likely a Web Application project. In that project type, the code files are compiled into an assembly (.dll) and that assembly is deployed to the server (the code files are not).
There is another project type called a Web Site, and that one works more like what you are looking for. The code files are deployed with the application, and if you edit any of them, the changes are available immediately (i.e. the code is recompiled).
There are other differences between the two, so please read up on them and decide if it's the right path for you.
Personally, I haven't worked with the Web Site project type in years. Back when it was first released, there was a big outcry against it (so much so that MSFT released an update to restore the Web Application project type), but this is all opinionated and it may work great for you.
There's an MDSN article that details the differences.
The intro paragraph tells you how to create a project of each type in Visual Studio.

Best way to reverse deploy an asp.net mvc web application which is not precompiled

I have a Visual Studio 2012, MVC 3, asp.net 4.5, c#, razor web application.
The original application is a 2 project solution with 1 project being the Data layer and the other the web application. When deployed the data layer is represented as a dll.
All Controllers and Views are still in "source" format on the deployed "test" platform, since I have not precompiled the code before deploying.
I have ftped the whole site back to my dev server into a seperate area.
I did try and open this downloaded application as a project and also a website, but got some reference errors.
I do appreciate this is a non ideal state of affairs, and this codebase should be represented as a previous version in source control. However for a number of reason, we need to do this, mainly because we did not do a branch. One lives and learns.
What should be the best way to open this site in Visual Studio to work on it. Obviously I will only have the one project now, as the data project is just another DLL? I will add this fix back to my main codebase, and recommit.
Thanks in advance.

MVC Requires Rebuild After Modifying View

I created a new MVC 4 project with a blank internet application template in VS2012 Ultimate.
For some reason this project requires me to stop and recompile when modifying even just a view or CSS file. Is there a VS setting or project setting I'm missing here? I understand that I should have to stop for modifying class files, but why am I having issues with the view?
-Ninja
My best guess is that the hosted code is at a different location from where it should be for a default VS solution.
The solution building is copying the code from you solution\project folder into the different location.
Try to check the location of the actual deployment. Depending upon whether you are using IIS, IIS Express there are different ways to know that.

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.

Can not remove Default.aspx from Asp.net MVC 3 Application

I am working on a project that started out using ASP.Net MVC 1 and has since been upgraded to ASP.Net MVC 3. It is my understanding that if I am running my ASP.NET MVC 3 app on IIS 7 using the integrated pipeline that I no longer need the Default.aspx file. However after I have removed the file from the project and physically deleted it I get the following error every time I try to compile in Release mode:
Description: Could not load type 'ProjectName.Default'.
File: Default.Aspx
I have verified that there is no instance of ProjectName.Default or Default.aspx in my project file. I have even done a grep search in all of my files in the project for any mention those names and still have found nothing. What do I need to do to be able to remove Default.aspx from my ASP.Net MVC 3 app and get it to compile in release mode. It compiles just fine in Debug mode by the way.
From the debugging listed here you probably had a cached version of your compiled code. While Visual Studio builds the code behind files into a single DLL, ASP.NET compiles each aspx file into a DLL as well (depending on how you configure it, there can be variations on this). These DLLs are located at %WINDIR%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files note that this directory is sensitive to .Net version, could be in 2.0 or 4.0, it is also in some way dependent on bit-ness, as there is a similar directory in Framework64.
I tried to clean my solution, delete the project temp files, remove all the leftover crud I could think of. Unfortunately none of this worked so I had to take the brute force approach and checkout a new copy of my project. After doing this I no longer had the error occur when building the new copy that had Default.aspx removed. Unfortunately this solution did not provide me any insight into what leftover file Visual Studio was holding onto.

Resources