简体   繁体   中英

Nerd Dinner returns 404s for all sub-pages

I just got a new Windows Server 2003 machine and I've been trying to get Nerd Dinner onto it. The server already has .NET 3.5 SP1, ASP .NET MVC, etc.

When I upload Nerd Dinner via FTP to a subdirectory of the main webpage, I get a 404 when I go to any page in the site except for the root and the home page doesn't event show the map.

For example, when I go to the about page, I get the following IIS log entry:

2009-08-13 17:56:10 128.200.123.118 GET /nerddinner/Home/About - 80 - 128.200.123.89 Mozilla/4.0+(compatible;+MSIE+8.0 <snip >) 404 0 3

I'm extremely puzzled because this is a freshly downloaded and compiled copy of Nerd Dinner from Codeplex.

In case it helps, here's a log entry from the failed attempts to get the JavaScript for the map (note the complete lack of "/nerddinner"):

2009-08-13 18:03:05 128.200.123.118 GET /Scripts/Map.js - 80 - 128.200.123.89 Mozilla/4.0+(compatible;+MSIE+8.0 <snip >) 404 0 3

I have a strong feeling that I should be able to fix this inside the asax.cs file but I can't quite get it to work even after appending "nerddinner/" to the front.

Any ideas for what's happening?

Edit: I uploaded it to the root of the webfolder and the 404s continue.

Edit 2: Thanks for the suggestions. I followed the instructions and now I don't get 404s. However, there are 2 major problems left:

  1. The scripts and content folders don't map correctly. I get 404s on all references to the files inside those folders.
  2. I can't view dinners at all. I get:
  3. \n

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

and a line in red that says "<connectionStrings configSource="ConnectionStrings.config" /> ". Except that ConnectionStrings.config doesn't exist on the server, so it wasn't an important file according to VS, and thus, I have no idea what the error is referring to.

(a quick search of my local hard drive turns up a ConnectionStrings.config file with nothing in it)

Edit 3:

Now I think I'm getting the equivalent of a SQL Server 404 when I go to view dinners...

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Summary To Help Others Running ASP .NET MVC on IIS6, Especially Nerd Dinner:

  1. IIS 6 may throw piles of 404s at you because it doesn't understand that files can have no extensions. To solve that, follow the steps in Phil Haack's blog post .
  2. ASP .NET MVC URL rewriting is not magic. It only rewrites URLs that are piped through code. References to scripts, images, databases, direct links (aka a href tags; not the ones that are dynamically generated) etc. are not remapped based on the directory of your application. For the Nerd Dinner application , go through the pages and add "/nerddinner/" in front of references to these references. Substitute "nerddinner" with the name of your subdirectory.
  3. Take the database and attach it to SQL Server (or SQL Server Express) on your server. Add the Network User to the database with read/write roles.
  4. Fill in the correct connection string for your setup. In my case, I was referring to the server by IP address and using SQL Server 2005 so my connection string is:

    <add name="NerdDinnerConnectionString" connectionString="Data Source=128.200.123.118; Initial Catalog=NerdDinner; Integrated Security=SSPI" providerName="System.Data.SqlClient.SqlConnection"/>

Are you running it on IIS6? If you are, you will need to patch the route table to take into account the .ASPX extension, which IIS6 more or less requires.

Phil Haack has a good walkthrough that explains this process. He also explains ways you can do it without the .ASPX extension:
http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

The scripts and content folders don't map correctly. I get 404s on all references to the files inside those folders.

In ASP.NET MVC files do not map one for one to an URL, like they do in ASP.NET. Instead, a match in the routing table diverts a GET or POST request from the browser to a controller method in one of your controllers. From there, the controller decides (either explicitly or by convention) which View to display.

An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

ConnectionStrings.config needs to exist on the server, since it is being referenced in web.config. It's an include file, so there doesn't necessarily have to be anything in it. But if it is being referenced, it needs to be included on the server, so just copy it there with your FTP program.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM