This project is read-only.

/User /Poll not working, can't register,login,vote 404 errors -fixed

Topics: Developer Forum
Aug 27, 2009 at 1:20 AM
Edited Aug 27, 2009 at 5:08 AM

I'm running on Windows Server 2003 and I'm using IIS 6.0.

I have the website up and running and in order to get it to work I followed what the book mentions and I:

Open IIS manager, right-click on TheBeerHouse, go to Properties, then Home Directory tab, then click Configuration. Under Wildcard application maps, click Insert (not Add, which is confusingly just above),  then entered C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll for “Executable”, and uncheck Verify that file exists. This allowed the routing to behaves as it always did in VS2008’s built-in server.

However when I try to click Login or browse to http://localhost/Views/User/Register.aspx I'm getting 404 errors such as:

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.

I've checked IIS and I see the aspx page under the views folder.

I can browse most other parts of the website. What am I doing incorrectly and why can't I register or login to the site?

I'm able to see the login screen on the demo site: http://thebeerhouseexample.com/User/Login so I imagine this should be working. Ideas?

Things I've tried but they haven't worked:

1. Added the following to web.config

<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Initial Catalog=TheBeerHouse;User Id=sa;Password=youdliketoknow;" providerName="System.Data.SqlClient"/>
<add name="TheBeerHouseConnectionString" connectionString="Data Source=.\SQLExpress;Initial Catalog=TheBeerHouse;User Id=sa;Password=youdliketoknow;" providerName="System.Data.SqlClient"/>

2. Tried to configure ASPNET_REGSQL.EXE and added a user. 

I was able to get this fixed by downloading the latest version of the source code, changeset 58165.

Aug 27, 2009 at 3:40 PM

MVC does not require extensions and in fact if you try to access them you will be denied. Because it uses RESTful URLs the default url pattern is going to be {Controller}\{View}\{ID}

so if you want to access user related stuff your url is going to be htt://localhost/User/Register . I hope that helps.

Nov 29, 2012 at 8:02 PM

woah,  GETTING this THEBEERHOUSE work is not easy

 

just like getting a BRIT not to confuse and think straight (they never did , by the way)

 

here is the  proof that I got stage 1 running -- at least, I could open the landing page , click here and click there

I know some [SHOP] kart thing and [FORUM] thing, still some method have to be fixed

 

but this is the proof that I get it working , at least the landing page,  and this is not easy at all, took me 12 hours, just fingering with the web.config file, connection string

 

if you enjoy the steps that I am going to show you , please show your gratitude by going to 

www.tiny.cc/uk_u   and give me more hits there 

 

 

this is the link of proof -- >>  http://i.imgur.com/jYCSO.png

 

 

 

first step

 

A__)

 

many of the codeplex file on thebeerhouse contains huge amount of  dotNET error 

 

so I picked this one , which is smaller and GOT ZERO error there  (only lot of messages about the web.config file)

 

 

called  thebeerhouse_MVC -- only got  4.6M only

 

could be second half missing, but  it is MVC linq sql -- so it is good enough (and not as 10 errors to begin with) during build

 

 

B

 

prerequistic is important too

 

running on XP

remove IIS 5.5 first, then install rubbish IIS 6 and MVC1 -- must be 1

 

then reinstall IIS5.5 in remove/add program

 

also   must be  upgrade to SQL server 2008 express R2

and

 

VS -- web  -- VISUAL web developer -- found an ISO somewhere that can install  any of the VS 2010 express series

 

 

although another environment for IDE has been suggest (somewhere)

 

 

i.e. all the 3 codeplex is NOT DOWNLOADABLE esp the database one

 

as the mdf database is HIDING in APP_CODE folder 

 

 

C

 

unzip the whole thing near your IIS virtual directory -- but don't need to set up virtual directory as there is a SLN -- solution folder

 

 

just open the SLN as OPEN PROJECT is   visual web developer software

don't have to attach the mdf (new one) in the database explorer in the software either

 

D

if your connection string is right, it will then automatically attach as a database file in the  TAB [DATABASE  explorer]

there should be a red cross in the attached database in the database explorer tab -- even it will become successful

 

but you could peek the database possible connection string by looking below for CONNECTION DATA SOURCE (in that database explorer tab) - that is the TIPS for us

 

E C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA

this step E is the important bit

 

copy the MDF and LDF file into this folder (I got 2008 express) -- don't copy to another folder as some guide in googling may suggest

if you don't follow my lead and copy into another folder, you could stuck like mine for quite a few hours

i.e. from app_data  folder into this folder  ---  then you can attach this inside [data folder of SQLserver express] as  ATTACH in the SQL server management tool

F

 

properties of DATABASE or SQLSERVER express tab of the SQL server express 2008 is quite important

how to do it -- you could find out

 

just remind that you should

 

somewhere [PROPERTIES] then left tab, click those thing on LEFT PANE

**** allow remote connection

 

database -- this one , should rename as  THEBEERHOUSEDB --- dunno why some called thebeerhouseVB after attachment

 

this could be a long random name, you should rename to this THEBEERHOUSEDB

 

and add a security tab -- USER -- called  q  / q  ---- q as username , q as password -- you will see this as my connection string

I might upload the file to SENDSPACE, so you could compare mine and yours

 

I don't like the book author use green remark text to tell us how to set this and set that, but not DATADIRECTORY of the connection string

he better give us some samples, instead of so many   academic green words

 

 

G

another important success key is this site

http://blogs.msdn.com/b/bahill/archive/2009/07/31/come-visit-revisit-the-beer-house-continuous-integration.aspx

 

but don't follow every step, try to understand he try to use some cloud environment, that we don't need

 

so I will pick out something that we should try -- skip the NEW QUERY attach stuff, we just use mouse to achieve copy and paste and ATTACH

 

H

 

remember few things, so you appreciate my guide more

 

each build of debug take about 2 to 3 minutes, so lont time to wait -- my machine is just 1G ram

and mostly  web.config  connection string GET WRONG, but show error elsewhere, so it is hard to follow those  dotnet message

 

only few comprehensive guide like the above link - so reading others google stuff is hard

 

and  DATADIRECTORY in connection string can contain space in the folder, e.g. BIG FOLDER,  it will be /BIG FOLDER/ .. in our connection string, space, no problem

 

I

 

follow this bit of the guide  -- http://blogs.msdn.com/b/bahill....

USE [TheBeerHouseDB]

GO

EXEC sp_addlogin 'TheBeerHouseApp', 'BeerNow!', 'master'

GO

EXEC sp_grantdbaccess 'TheBeerHouseApp', 'TheBeerHouseApp'

GO

EXEC sp_addrolemember 'db_datareader', 'TheBeerHouseApp'

GO

EXEC sp_addrolemember 'db_datawriter', 'TheBeerHouseApp'

GO

EXEC sp_addrolemember 'db_owner', 'TheBeerHouseApp'

GO

 

you may repeat it and delete the bit that you have done -- if you get lost already

look at the above, remember that during attachment , we right click the long random name and we already RENAME it as

 

thebeerhouseDB  -- so we do the above

 

---- after that -- I am not sure where is or what the hell are those SQL diagram table, but we an execute this bit anyway

 

This sample database includes some of the SQL diagramming tables.  We won’t need these so you can clean them up by executing this T-SQL:

USE [TheBeerHouseDB]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_alterdiagram]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[sp_alterdiagram]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_creatediagram]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[sp_creatediagram]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_dropdiagram]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[sp_dropdiagram]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_helpdiagramdefinition]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[sp_helpdiagramdefinition]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_helpdiagrams]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[sp_helpdiagrams]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_renamediagram]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[sp_renamediagram]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_upgraddiagrams]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[sp_upgraddiagrams]

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sysdiagrams]') AND type in (N'U'))

DROP TABLE [dbo].[sysdiagrams]

GO

 

again , just a reminder, we use the ADD NEW QUERY [left button] -- put all the above stuff there, then hit the red ! mark for running those

 

as long as you open the web.config file in VS 2010, you will see lot of these {{messages}}

 cannot find the schema of this and that -- about 15 of those

THAT IS NOT THE PROBLEM (at least for now), you can safely ignore those - messages- we can only see that when web.conf  file is being opened, so close it 

 

finally , the most important bit of the whole thing  ---    HOW TO WRITE THAT dAMN connection string -- this is the few hours worth of learning curve, and also why YOU ARE reading this now

remember it is not something wrong with ARTICLEQUERIES.cs although it is always pointing to that file

 

the debugger will always point to here

/// <returns></returns> public static int GetPublishedArticlesCount(this Table<Article> source) { return GetPublishedArticles(source.Context as TheBeerHouseDataContext, null).Count(); }

 

but the problem is not articlequeries.cs, but how to write that damn connection string

in short, the solution is

 

 <connectionStrings>    

  <remove name="LocalSqlServer" />

<add name="LocalSqlServer" connectionString="Data Source=FUJITSUANDREW\SQLEXPRESS;AttachDbFilename=~/TheBeerHouse/App_Data/TheBeerHouseDB.MDF;Initial Catalog=TheBeerHouseDB;Integrated Security=True;" providerName="System.Data.SqlClient" /> 

  <remove name="TheBeerHouseConnectionString" />   

<add name="TheBeerHouseConnectionString" connectionString="Data Source=FUJITSUANDREW\SQLEXPRESS;User Id=q;Password=q;Initial Catalog=TheBeerHouseDB;" providerName="System.Data.SqlClient" /> 

</connectionStrings>
  

I cannot format my answer further, otherwise, you cannot copy and paste

obviously, when I  log onto my SQL server with windoww authentication

 

I will use  FUJITSUANDREW\SQLEXPRESS

 

and you notice , I got a SQL user called  q /q with dba owner right to this database -- i.e. thebeerhouseDB

 

 

you also notice the above

 

another new user (that we execute ) is called  

 

TheBeerHouseApp / BeerNow!  -- but this guy don't have much admin rights, may only go into read the database

 

 

 

i.e. q   /q   is another guy

 

 

 

HOPE that you know how to create a portal with MVC  LINQ SQL now -- hard to take that language too -- suppose to be easier or harder to learn ??

 

 

 

and if you can complete the 2nd half of the instruction on that blogger    -- that http  --   blogs.mdsdn...... there are much to go forward

 

 

 

 

if you cannot remember this link

 

easy

 

 

remember this one

 

 

www.tiny.cc/thebeerhouse

 

 

also please read the big british U scand for  www.tiny.cc/UK_U

 

 

 got doubt in using those 3 files -- as it got too many error to begin with, anwe

have a nice day, and in the codeplex, --the beerhouse, source code -- patches, those are very useless as I suppose that all the patches got update to the  downloadable file and I stuck in this connection string for a long time already, we may try those later already-- again,