MVC Missing Views - c#

We have a legacy Web Forms application which we've recently converted from a website project to a web application project.
The Web Forms project is the "startup" project of the solution.
There is an MVC project which is a reference to the Web Forms project.
In the MVC project, there are several view (cshtml) files that are set as "Embedded Resource". When the application is debugged locally in visual studio, these files are found and compiled and the pages are visible.
When the Web Forms project is published (locally), I get an error that says "The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:" etc
The question is how come this works on IIS Express but not on IIS 10? Is there some config settings I can update to make this work?

Do you have a Virtual Path Provider in the WebForms project?
Try installing my project 'EmbeddedResourceVirtualPathProvider'
Install-Package EmbeddedResourceVirtualPathProvider
https://github.com/mcintyre321/EmbeddedResourceVirtualPathProvider/

Related

Bundle Config in MVC 5 is not rendering after hosting the application in IIS

We are developing an application in MVC5 and using Visual studio 2017.
We have added all the common jquery and css files in bundle config but those are not rendering after the application is getting hosted in IIS. In the development phase, the application is working perfectly.
Referring the layout page.
WebGrease is also added by default as a reference in the project.
Please help to complete the hosting.
The issue is likely due to you having a bundle configured like this:
new StyleBundle("~/Content/css")
whilst at the same time having a Content folder in the project, that has a css subfolder.
Change the bundle name so that it doesn't clash with a real folder, and it should work.

Visual Studio 2013 web forms project (.NET 4.5 and above) fails when deployed to hosting service. Runs locally

I've recently been working with ASP.NET again and decided to create a small ASP.NET project in a subfolder on one of my websites. I'm using Visual Studio 2013 and created the project using the ASP.NET Web Forms Application template. After creating the project, I left everything at the default, verified that it would build locally, published it to a folder on my system and then copied the published files via FTP to the subfolder on my site. When I tried to bring it up in my browser, it failed with the code ERR_CONNECTION_RESET. This told me that the host was seeing something there, otherwise it would have gone to my site's main 404 page. Chrome also refused to load the other pages within the deployed template. I did set the folder as an application in IIS after getting another error about forms authentication but that didn't have any effect.
I was able to successfully re-deploy an old ASP.NET site created with .NET 4.0 in VS2010. I was also able to deploy and load a project created in VS2013 / ASP.NET 4.5.1 with the ASP.NET Empty Web Application template.
I finally finally get the Web Forms template to work by doing the following -
Created a basic Default.aspx page with no master page.
Created a basic web.config file (copied from another new empty
project)
Commented out the following lines in the Application_Start function of Global.asax
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterOpenAuth();
RouteConfig.RegisterRoutes(RouteTable.Routes);
At that point, the project ran on the host with no problem. I then restored the Default.aspx and Web.config files and the project again failed, even with the Global.asax lines still commented.
I also changed the SessionState mode to "Custom" as suggested in the web.config file and this made no difference.
My question at this point is this - Has anyone else deployed a .NET 4.5.1 Web Forms app designed from the VS2013 template to a shared hosting service and is there something that you have to do to get it to work?
I'm fairly satisfied at this point that I can use the empty web application template and build things from scratch but I'd like to know if anyone else has run into this and what they did.
Thanks.
ERR_CONNECTION_RESET sounds to me like you were having some kind of Internet connectivity troubles, or your server was having some sort of Internet connectivity trouble. If it's working fine now, probably nothing to worry about.
Has anyone else deployed a .NET 4.5.1 Web Forms app designed from the VS2013 template to a shared hosting service and is there something that you have to do to get it to work? Yes, lots of people have done that.

MVC Application Created in Visual Studio 2012 is not working properly after deploying on IIS

I have created a simple MVC3 application in Visual studio 2012. Earlier I was using VS2010. Both are currently Installed on my System.
The Problem is that when I publish and Deploy the application on IIS It doesn't works.
It gives Error Code 0x00000000
I tried with different applications but problem remains the same. Any of the application created in VS2012 is not deploying Successfully. Please Help.
I am adding snapshot of publish and error message.
looks like you are publishing an mvc3 app.
If I remember correct for that version you either have to install mvc on the server or include mvc binaries in your output directory.
There was a menu item for mvc project (right click on a project in solution explorer) to add mvc dependencies to some binpub folder. You should look for that.
oh and here is a Hanselman post on the topic
http://www.hanselman.com/blog/BINDeployingASPNETMVC3WithRazorToAWindowsServerWithoutMVCInstalled.aspx
And another SO question: Why is the _bin_DeployableAssemblies folder specific to web applications?

How to do a precompiled web application

I have a webapplication that uses a master page. When I publish the site in vs2010 (running framework 4), and then I navigate to the default.aspx page I get a parser error that the masterpage's codebehind file does not exist.
I know that a website can be precompiled and then deployed which means there would never be anything that IIS needs to parse. The above error therefore implies that IIS is still trying to compile my precompiled site.
Is there something that needs to be configured to stop the web application from doing this?
Convert to Web Application: Difference between 'Web Site' and 'Project' in Visual Studio
Have you uploaded the bin folder with the webapplication's dll?
You are using the term 'web application' and 'website' interchangeably in your question.
If you are using the web application model, you need to build it before deployment (i.e to a single binary)
If you are using the website model, you need to deploy all your files (code behind included), the framework then JIT compiles all your codebehind.
But you can pre-compile:
http://msdn.microsoft.com/en-us/library/ms227972.aspx

ASP.net MVC Web Deployment Project

I created an ASP.net MVC 2 Web Application in Visual Studio 2010. I then added a Web Deployment Project to the solution and added the Primary Output from my web application. I right clicked on the web deployment project in Visual Studio and clicked Install and ran through the install. I then tried to use IIS to browse to the page and got the following:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
I browse to the folder that the application is and all I see is a bin folder and inside that there are just a few dll's. No web.config. Nothing else. Is there something else I need to add to the deployment project other than primary output?
I had to add the Content Files from the Project as well. Once I added both Content Files and Primary Output everything worked fine.

Categories

Resources