Unable to run empty ASP.Net MVC 3 Application - asp.net

I have installed:
Visual Web Developer 2010 Express
ASP.Net MVC 3
I went to File > New Project > ASP.Net MVC 3 Web Application
I chose Empty template with ASPX view engine. VWD generated lots of files.
When I clicked Run, I get the following error:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.
Requested URL: /
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.1
What am I missing here? Is there something else that needs to be done to get it running?

Yes, that's true
An empty application doesn't have a single controller or view defined. It's all on you. Most people start with an application.

Related

Simple Asp .Net Application, error : Server Error in '/' Application

Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Version Information: Microsoft .NET Framework Version:2.0.50727.8689; ASP.NET Version:2.0.50727.8670
Configuration: .Net framework 3.5, windows 10 operating system [IIS express 10]
How can I solve this Problem, Please help me
Hosting server will typically generate a "404 Not Found" web page when a user attempts to follow a broken or dead link.
Check the URL and look for resource (webpage/service/view) does exist?
This means that the url you tried to access doesnt exist, or the IIS is not running, are you sure you ran it from visual studio using F5 ?

Recreating solution file in Visual Studio 2010

I need help re-creating a web solution file (at least I think that is what I need). I inherited a web application from another developer that left our company. It was created in Visual Studio 2010 and uses ASP.Net 2.0. There was no solution file, so I created a web application project and manually added all folders and files into my new solution. I did not make any changes to any file in the web application.
When I run the app from within Visual Studio, it starts up to the default page fine, but when I click a link on that same page, I get:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could
have been removed, had its name changed, or is temporarily unavailable. Please review the
following URL and make sure that it is spelled correctly.
Requested URL: /SomeCompany/startProject.aspx
Version Information: Microsoft .NET Framework Version:2.0.50727.8009; ASP.NET Version:2.0.50727.8008
My original start location: http://mylocalurl:65212/default.aspx
Link on the default page: http://mylocalurl:65212/SomeCompany/startProject.aspx
If, after clicking the link and getting the error page, I can remove "/SomeCompany/", and successfully get to the page. But I've seen the previous developer run it in Visual Studio and click the exact same link with no problem.
I need it to have the /SomeCompany/ in the url and work just like the previous developer had it so I can maintain and debug it as needed. What am I doing wrong in re-creating the solution...or is it another setup problem that I am not thinking of?
You could have probably just used file -> open web site. It probably is not a Web Application. Visual Studio has multiple types of web projects. Visual Studio will create a solution for you that you can save after you open the website.
Web Application Projects versus Web Site Projects in Visual Studio

MVC4 Application on Azure not working

I am deploying a ASP.NET MVC4 to Azure web site for the first time.
Stack:
Visual Studio 2013 Professional Update 1
.NET 4
ASP.NET MVC 4
Using Razor
IIS7
I have downloaded publish profile and have imported in Publish settings. Build is successful so is deploy.
When I go to home page i.e. mywebsite.azurewebsites.net/ I get: This web site has been successfully created message.
When I try going to /Account/Login => I get 404.
When I run /test.aspx (this is page I have added to project for testing) it executes and returns the page output.
I had same issue when I tried deploying MVC application to IIS6, where extensionless path was not handled so I had to enable wildcard handler.
How to resolve MVC issue on Azure?
Update 1
I have created a new ASP.NET MVC 4 project (Razor) using .NET 4.5. I have installed latest Azure SDK for Visual Studio 2013. So, this is empty project created from Visual Studio template, I have not did any further adjustments and it works on local IIS. I did a deploy according to Azure documentation.
Result:
403 on home page.
404 on Home controller url (http://mywebsite.azure.site/Home)
I found the problem.
I had "Precompile during publishing" checked in "File Publish Options". It was generating PrecompiledApp.config and Global.asax was missing.
When I have unchecked "Precompile during publishing" option, everything was fine.
I think you need to change your routes in RouteConfig.cs . I see you are trying /test.aspx , but I would try a restful folder. Look in your Controllers folder.
for example if you see:
Home
Then I would try mywebsite.azurewebsites.net/home
I see you are trying Account/Login I would NOT do this to troubleshoot as you just may have added complexity to your problem with AUTH...
Your routes are definitely needing to be looked at. Also locally you may want to run on IIS Express or your local IIS etc... and test different controllers.
The tweaking of your routes can easily cause the Account/Login to show this error locally
The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts".
And then on publishing,... the 404 --> "An error occurred while processing your request." etc..
I like to use Visual Studio Publish, just install the azure sdk for vs 2013 etc..
https://azure.microsoft.com/en-us/documentation/articles/web-sites-deploy/

How to set up IIS6 to host ASP .NET 4 MVC4 application

I'm having a hard time configuring my server to host MVC4 application. Here's my situation:
I have Windows 2003 server SP2
Until now, all my hosted applications are targeted to .NET Framework 3.5, thus using ASP .NET 2. I use single web site to host web application
Now, I want to host very first application targeted to ASP .NET 4
What I did is:
I've installed .NET Framework 4
I've added new new application pool
I've added new virtual directory to my web site (the same web site that hosts ASP .NET 2 web apps) and converted it to web application. Next, I've selected ASP .NET version 4 on ASP .NET tab
So, I thought that it would be enough. But when I access my application with root url, the first thing I get is 403. I've checked security options and they seem to be all right.
Next, I tried to access one of my controller actions, eg:
http://servername/home/index
and now I get 404 error. Ok, so I've enabled browsing of files and I tried to access web.config, for to check what happens, and I received error:
Could not load file or assembly 'System.Core, Version=2.0.5.0,
Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or
one of its dependencies. The given assembly name or codebase was
invalid. (Exception from HRESULT: 0x80131047)
I've also run regiis command:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -s W3SVC/2049612577/root/cip-new/
but still in vain. Bottom line, it's something wrong, but I have not idea what is happening.
EDIT 1:
I've made some testing. What I did, is I'd created a basic MVC4 application from Basic template and simply published it to the server. And it worked. However when I published it to the server to the same directory, I got the error:
The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047).]
2 things I've had to do in the past to get v4 working on IIS6...
Make sure the site using .Net version 4.x runs in it's own app pool, separate to sites using .Net version 2.x
If you are using Razor I've noticed that IIS6 doesn't immediately know what to do. So you need to configure the Application Extensions Mappings. Add an extension mapping for .cshtml or .vbhtml depending on whether using C# or VB. I think that's why you're getting your 404 errors.
Restart IIS or recycle relevant app pools once above applied if you can to make sure changes are in effect.

visual studio asp.net mvc, changing target framework

Hello there Im have just changed the target framework for an asp.net mvc project from target framework 4 t 3.5, I keep getting this error when I try to debug, or go to any controller action
'HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. '
Any ideas why I keep getting this error? as soon as I revert back to .net 4.0, everything is fine
ps could be an issue with routing as the global.asax Application_Start() is not not hit hence route entries are not registered
Thanks
Are you running the site on IIS or Casini? If IIS, you should also check that the Application pool is targeting .NET Runtime 2.0

Resources