 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

August 22nd, 2012, 06:26 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You could script the contents of the database and run the resulting file against your production database. You could use the database publishing wizard for that, or use the scripting facilities found in SQL Server Management Studio.
Cheers,
Imar
|
|

August 22nd, 2012, 07:04 AM
|
|
Authorized User
|
|
Join Date: Jun 2012
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Here is what I've tried with no success:
1) I used the "Publish to Provider" tool on my PlanetWrox database in MS Web Developer, created a new database at my host and ran the query - resulting in a new database with all my original tables (Genres, Reviews etc)
2) I used the aspnet_regsql tool and ran it against my new hosted database, it now has membership services too.
3) Again I ran the "Publish to Provider" tool, this time on ASPNETDB, ran the query on my hosted database, after checking the table data, it all seems equal between the 2 databases.
4) Changed my web.config file: On membership providers I changed connectionStringName="LocalSqlServer" to connectionStringName="PlanetWroxConnectionString1" .
I went to check my website online, everything seems to be running fine but when I try to login, bam, I get the SQL connection error.
What exactly am I doing wrong here?
|
|

August 22nd, 2012, 07:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
"the SQL connection error" isn't very descriptive.....
Imar
|
|

August 22nd, 2012, 07:12 AM
|
|
Authorized User
|
|
Join Date: Jun 2012
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Sorry,
Quote:
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)
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: 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)
|
Here is a live example:
http://jdlferreira.org/orangefresh/
Login box on the right.
|
|

August 22nd, 2012, 07:21 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
That sounds like the application is still trying to find the wrong SQL Server. Did you update the configuration for membership to look at your production database?
Imar
|
|

August 22nd, 2012, 07:27 AM
|
|
Authorized User
|
|
Join Date: Jun 2012
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
I assumed changing the connectionStringName to the name we use for the original db would be enough, is there anything else I need to add to my web.config file?
|
|

August 22nd, 2012, 07:47 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, that should be enouh. And then the database in that connection string must be reachable, and the account used by you site needs the proper permisisons on it....
Imar
|
|

August 22nd, 2012, 07:54 AM
|
|
Authorized User
|
|
Join Date: Jun 2012
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Hmm, this is strange then. All the other pages that make use of my db are working fine, it's just the logging in that seems to have problems.
Guess I'll have t go back on the drawing board on how to create the db, I'm not entirely sure running an ASPNETDB script against another database that already has membership services is the best idea...
|
|

August 22nd, 2012, 08:15 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Can you post your Web.config for the site (with any passwords removed)? Also, does the account have the necessary permissions to the membership etc. objects (configured through the ASP.NET roles that aspnet_regsql creates)?
Imar
|
|

August 22nd, 2012, 09:34 AM
|
|
Authorized User
|
|
Join Date: Jun 2012
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Here is my web.config:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="orangefreshConnectionString1" connectionString="Data Source=ns2.serverhswin.org;Initial Catalog=jdlferre_orangefresh;User Id=user;Password=pass;" providerName="System.Data.SqlClient" />
<add name="orangefreshEntities" connectionString="metadata=res://*/App_Code.Orangefresh.csdl|res://*/App_Code.Orangefresh.ssdl|res://*/App_Code.Orangefresh.msl;provider=System.Data.SqlClient;provider connection string="Data Source=ns2.serverhswin.org;Initial Catalog=jdlferre_orangefresh;User Id=user;Password=pass;"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.web>
<customErrors mode="Off"/>
<roleManager enabled="true" />
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="orangefreshConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="default.aspx"></forms>
</authentication>
<pages theme="orangefresh" />
<compilation debug="false" targetFramework="4.0">
<assemblies>
<add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
<buildProviders>
<add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
</buildProviders>
</compilation>
<httpRuntime requestValidationMode="2.0" />
</system.web>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="João <[email protected]>">
<network host="mail.jdlferreira.com" userName="email" password="pass" />
</smtp>
</mailSettings>
</system.net>
<location path="Management">
<system.web>
<authorization>
<allow roles="Admin"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>
Is it required to configure the profile and roleManager settings? I didn't include those.
|
|
 |
|