p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 (http://p2p.wrox.com/forumdisplay.php?f=228)
-   -   Wrox with VS Pro and SQL Server 2005 Standard (http://p2p.wrox.com/showthread.php?t=35977)

danjpohl December 9th, 2005 04:37 PM

Wrox with VS Pro and SQL Server 2005 Standard
 
I am very new to SQL Server and even newer to ASP and even newer yet to IIS. I spent about 7 hours trying to get the demo up and running with the tools I was going to use in production. My own fault for not using the recommended tools.

I have the following setup on my pc:

- SQL Server 2005 Standard Edition
- Visual Studio 2005 Profesional Edition
- IIS 5.1

Knowing nothing about IIS and SQL security were the bigest issues.

Thanks to JJJones3860 and Dave Sussman for clues in there other posts. www.ASP.NET also helped.

Here are the steps I used to get it going.


1 - Created "c:\websites\WroxUnited"
2 - Extracted the files from FinalApp.Zip into the WroxUnited folder - Make sure you only have one level of "WroxUnited and not "c:\websites\WroxUnited\WroxUnited"
3 - Add "Network Service" access to "c:\websites\WroxUnited\app_data"
4 - Opened up Control Panel\administrative Tools\Internet Information Services
5 - Expand your local computer \ websites6 - Right Click on Default Web Site and add New Virtual Directory
7 - Enter "WroxUnited" for Alias
8 - set directory to "c:\websites\WroxUnited"
9 - Kept defualts for directory permission (MAY BE WHY MY DB IS READ ONLY????)
10 - After the Virtual Directory is created expand Default Web Site, right click on WroxUnited and select properties
11 - Select the ASP.NET tab
12 - Make sure ASP.NET version is 2.0.50727 –
13 - Then hit the apply button
14 - Select Edit Configuration
15 - Highlight LocalSqlServer and hit edit
16 - Change SQLSERVEREXPRESS to either (local) or your Local SQL Server Name (I entered "DPSQL" - My server shows up as "DPOHL\DPSQL")
17 - On the same line remove ";User Instance=true" from the end of the line (this is only used in sqlserverexpress)
18 - Save that line
19 - Highlight the WroxUnited line and repeat steps 16 - 18
20 - Hit ok a couple of times to get out
21 - Started my sql server
22 - Added a logon with the server role "sysadmin" for the user "DPOHL2\ASPNET"
23 – Open up http://localhost/wroxunited in your browser
24 – Your databases have now been attached to the sql server as read only
25 – Open up SQL Server Management Studio
26 – Connect to your Server
27 – Expand databases and right click the first newly added databases and choose properties \ Options
28 – Scroll to the bottom and set read only to false
29 – Repeat steps 27 – 28 for the second database

Now you should be good to go.

If anyone more knowledgeable can shed any other hints or corrections to what I went through that would be great!


sharking December 15th, 2005 02:19 AM

I meet this question too,But when you set your sites index docoument to default.aspx,You can run sites ok!
But I don't know why?


Chrisull January 16th, 2006 10:42 AM

Hi Dan,
       We're looking into the ASP.NET/IIS installation. I didn't have any problems getting IIS to work with ASP.NET 2.0 and Sql Express, but I didn't have a copy of SQL 2005. However everybody else including the editor on the C# version of this book is, so we're going to revise it so it talks about both the SQL Express and SQL Server guidelines. I'm surprised you have to edit the connection strings, but then again not that surprised. It seems like a fairly rational set of steps. I see if I can streamline it at all. Anything else I come across in the course of my investigations, I'll post here.

Chris

Chris Ullman
Programmer/Technical Author
http://www.cuasp.co.uk

jpamental January 19th, 2006 04:02 PM

Along those lines-

It seems that the Membership provider (the ASPNETDB.MDF) will only work if you have SQL Server Express installed. I haven't tried to confirm this by putting it up on one of our servers that is using SQL Server 2005 but I remember something about SQL Express being required for separate DB files to work.

I've looked at creating a different provider to utilize SQL Server instead, but it's pretty daunting. Have you guys looked at that at all?

Thanks- and love the book so far. Worked through up to page 252 in the past two days and have learned a lot. (Been using VS 2003 for the past year and what a huge improvement...)

Jason


jpamental January 19th, 2006 04:47 PM

OK - a little more info. It >might< work, but we're using a named instance of SQL Server, so it crashes out with an error message saying it can't find an instance of SQL Server. I just don't know how to tell the application to look for a specific SQL Server as a provider.

Any tips would certainly be helpful!

Jason


Imar January 19th, 2006 05:44 PM

You can use SQL Server 1005 with the same provider. However, you need to do some manual setup as no database will be created automatically.

Scott Guthrie's Blog explains how to do it: http://msdn.microsoft.com/asp.net/de...aspnet_sql.asp

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: A Rush Of Blood To The Head by Coldplay (From the album: A Rush Of Blood To The Head) What's This?

jpamental January 19th, 2006 06:01 PM

Imar,

Thanks so much for the link. I had actually just gotten it to work from another similar post, but Scott's article is much more specific. That's perfect!

Jason


rutledj January 19th, 2006 10:28 PM

I was having problems so I uninstalled sqlexpress and installed the full blown sqlserver 2005 developer edition. Went back through and setup the virtual directory, etc. Now when I enter http://localhost/wroxunited I get a directory listing of the folder. I probably gave too much access. If I double-click on the default.aspx page I get this message:

Server Error in '/WroxUnited' Application.
--------------------------------------------------------------------------------

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:


Line 112: Public Overridable Property Theme() As String
Line 113: Get
Line 114: Return CType(Me.GetPropertyValue("Theme"),String)
Line 115: End Get
Line 116: Set


Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\wroxunited\4d46c25b\c57181c9\App_Code.viz6ue wx.6.vb Line: 114

Stack Trace:


[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
   System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +734787
   System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820
   System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
   System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
   System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
   System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
   System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +496
   System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Web.DataAccess.SqlConnectionHolder.Open(Htt pContext context, Boolean revertImpersonate) +84
   System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String connectionString, Boolean revertImpersonation) +197
   System.Web.Profile.SqlProfileProvider.GetPropertyV aluesFromDatabase(String userName, SettingsPropertyValueCollection svc) +766
   System.Web.Profile.SqlProfileProvider.GetPropertyV alues(SettingsContext sc, SettingsPropertyCollection properties) +428
   System.Configuration.SettingsBase.GetPropertiesFro mProvider(SettingsProvider provider) +410
   System.Configuration.SettingsBase.GetPropertyValue ByName(String propertyName) +117
   System.Configuration.SettingsBase.get_Item(String propertyName) +89
   System.Web.Profile.ProfileBase.GetInternal(String propertyName) +36
   System.Web.Profile.ProfileBase.get_Item(String propertyName) +68
   System.Web.Profile.ProfileBase.GetPropertyValue(St ring propertyName) +4
   ProfileCommon.get_Theme() in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\wroxunited\4d46c25b\c57181c9\App_Code.viz6ue wx.6.vb:114
   Wrox.Web.GlobalEvents.ThemeModule.app_PreRequestHa ndlerExecute(Object Sender, EventArgs E) in C:\Websites\WroxUnited\App_Code\ThemeModule.vb:30
   System.Web.SyncEventExecutionStep.System.Web.HttpA pplication.IExecutionStep.Execute() +92
   System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +64




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42


Went back into sqlserver and verified that remote connections are allowed. Any suggestions?



Chrisull January 20th, 2006 07:38 AM

Ok as mentioned in the other thread it's harder to get the example db working with SQL 2005 than with SQL Express (but not impossible). I've consulted with Dave Sussman and here's his solution (I haven't yet got SQL 2005 but will have it shortly):

There are several things that need doing to WroxUnited to run everything in full SQL

1. Add the [machine\ASPNET] and [NT AUTHORITY\NETWORK SERVICE] as logins
2. Attach the database (wroxunited.mdf), makeing ASPNET the db_owner
3. Add [machine\ASPNET] and [NT AUTHORITY\NETWORK SERVICE] as database users
4 Change the connection strings in web.config. That should be all for the WroxUnited database - then there's the providers, which can either be added to WroxUnited db or to a separate one.
5. Run aspnet_regsql (in the framework directory), to add the user/roles/etc tables/procs to he appropriate datbase
6. Add provider sections in web.config, for <membership>, <roles>, <profile>, setting the default provider for each to the new provider added. These providers should point at the ConnectionString for the database (so either WroxUnited or a new conn str if using another database).

The error message I must admit is odd, the remote connections bit is slightly offputting, that isn't the kind of error message we'd normally expect. However before we pursue that line of inquiry any further, please try the above first.

Chris


Chris Ullman
Programmer/Technical Author
http://www.cuasp.co.uk

DaveSussman January 20th, 2006 07:43 AM

I should add that that list isn't something I've made as I've tested this. I've been ultra-busy of the last few weeks (hence my lack of interaction here), and this list of steps is from memory. I'll try and make time this weekend to test this myself, and will document the steps, and we'll get these into the C# version of the book, as well as putting them on the live site. I'm thinking it would be good to have a notes section where we document this sort of stuff.

Dave



All times are GMT -4. The time now is 10:05 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.