Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > ASP.NET 4.5 General Discussion
|
ASP.NET 4.5 General Discussion For ASP.NET 4.5 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4.5 General Discussion 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
 
Old October 31st, 2014, 02:09 AM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default connection string for a remote database server

Hi,
I am hosting my website through godaddy.
I have followed all the chapters of the beginning asp.net 4.5 book and after I completed the book I created a similar website and kept a lot of the features from the try it out exercises.
one of them is the planetwrox database
I am using these connections strings:

<connectionStrings>
<add name="PlanetWroxConnectionString1" connectionString="Data Source= P3NWPLSK12SQL-v03.shr.prod.phx3.secureserver.net; Initial Catalog=PlanetWrox;User ID=dksellou;password=password" providerName="System.Data.SqlClient"/>
<add name="PlanetWroxEntities" connectionString="metadata=res://*/App_Code.PlanetWrox.csdl|res://*/App_Code.PlanetWrox.ssdl|res://*/App_Code.PlanetWrox.msl;provider=System.Data.SqlCl ient;provider connection string=&quot;Data Source=P3NWPLSK12SQL-v03.shr.prod.phx3.secureserver.net;Initial Catalog=PlanetWrox; User ID=dksellou;password=password;MultipleActiveResult Sets=True&quot;" providerName="System.Data.EntityClient"/>
</connectionStrings>

I exported my database to the remote database server (see data source above).
My sign up aspx page (identical with the one at the book) is not working.
I asked godaddy to give me the name of the connection string and they told me it is:

Data Source=P3NWPLSK12SQL-v03.shr.prod.phx3.secureserver.net;Integrated Security=False;User ID=dksellou;Connect Timeout=15;Encrypt=False;Packet Size=4096

any idea how to alter my connection strings (above) to the one they gave me? What should I keep and what should I delete from my original connection string above.

To be honest, well it is obvious, I don't have inside my head a very clear understanding about databases and everything related to them . Chapters 13, 14, and 15 were a little hard for me...
Please help!

Last edited by dksellou; October 31st, 2014 at 02:11 AM..
 
Old November 3rd, 2014, 02:50 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

For the first connection, you should replace the entire connectionString attribute.

For the second you should replace everything in the provider connection string section but leave in the MultipleActiveResult Sets=True part.

Page 744 and 751 have more examples.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
dksellou (November 3rd, 2014)
 
Old November 3rd, 2014, 03:08 PM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Thank you so much Imar.
I will do as you say, tonight...I feel so lost!
:)

P.S. Are you sure it is 744 and 751? I have the begining aspnet 4.5

Last edited by dksellou; November 3rd, 2014 at 03:17 PM..
 
Old November 3rd, 2014, 03:25 PM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default

This is what I have done after the changes you suggested..
<connectionStrings>
<add name="PlanetWroxConnectionString1" connectionString="Data Source=P3NWPLSK12SQL-v03.shr.prod.phx3.secureserver.net;Integrated Security=False;User ID=dksellou;Connect Timeout=15;Encrypt=False;Packet Size=4096" providerName="System.Data.SqlClient"/>
<add name="PlanetWroxEntities" connectionString="metadata=res://*/App_Code.PlanetWrox.csdl|res://*/App_Code.PlanetWrox.ssdl|res://*/App_Code.PlanetWrox.msl;provider=System.Data.SqlCl ient;provider connection string=&quot;Data Source=P3NWPLSK12SQL-v03.shr.prod.phx3.secureserver.net;Integrated Security=False;User ID=dksellou;Connect Timeout=15;Encrypt=False;Packet Size=4096;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>
</connectionStrings>

It doesn't work....

I get the message "an error has occurred..."

Last edited by dksellou; November 3rd, 2014 at 04:47 PM..
 
Old November 3rd, 2014, 04:56 PM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default

ok I turned off the errors mode at webconfig and tried to sign up using the sign up page:
This is what I get:

Login failed for user 'dksellou'.
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: Login failed for user 'dksellou'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Login failed for user 'dksellou'.]
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352431
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +69
System.Data.SqlClient.SqlInternalConnectionTds.Com pleteLogin(Boolean enlistOK) +30
System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +317
System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +891
System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +518
System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +278
System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +732
System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85
System.Data.ProviderBase.DbConnectionPool.TryGetCo nnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1057
System.Data.ProviderBase.DbConnectionPool.TryGetCo nnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGe tConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +196
System.Data.ProviderBase.DbConnectionInternal.TryO penConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +146
System.Data.ProviderBase.DbConnectionClosed.TryOpe nConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +16
System.Data.SqlClient.SqlConnection.TryOpenInner(T askCompletionSource`1 retry) +94
System.Data.SqlClient.SqlConnection.TryOpen(TaskCo mpletionSource`1 retry) +110
System.Data.SqlClient.SqlConnection.Open() +96
System.Data.Entity.SqlServer.<>c__DisplayClass2f.< UsingConnection>b__2d() +73
System.Data.Entity.SqlServer.<>c__DisplayClass1.<E xecute>b__0() +10
System.Data.Entity.SqlServer.DefaultSqlExecutionSt rategy.Execute(Func`1 operation) +189
System.Data.Entity.SqlServer.DefaultSqlExecutionSt rategy.Execute(Action operation) +78
System.Data.Entity.SqlServer.SqlProviderServices.U singConnection(DbConnection sqlConnection, Action`1 act) +229
System.Data.Entity.SqlServer.SqlProviderServices.U singMasterConnection(DbConnection sqlConnection, Action`1 act) +195

[InvalidOperationException: This operation requires a connection to the 'master' database. Unable to create a connection to the 'master' database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection.]
System.Data.Entity.SqlServer.SqlProviderServices.U singMasterConnection(DbConnection sqlConnection, Action`1 act) +371
System.Data.Entity.SqlServer.SqlProviderServices.G etDbProviderManifestToken(DbConnection connection) +201
System.Data.Entity.Core.Common.DbProviderServices. GetProviderManifestToken(DbConnection connection) +87

[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
System.Data.Entity.Core.Common.DbProviderServices. GetProviderManifestToken(DbConnection connection) +271
System.Data.Entity.Utilities.DbProviderServicesExt ensions.GetProviderManifestTokenChecked(DbProvider Services providerServices, DbConnection connection) +33

[ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
System.Data.Entity.Utilities.DbProviderServicesExt ensions.GetProviderManifestTokenChecked(DbProvider Services providerServices, DbConnection connection) +193
System.Data.Entity.Infrastructure.<>c__DisplayClas s1.<ResolveManifestToken>b__0(Tuple`3 k) +32
System.Collections.Concurrent.ConcurrentDictionary `2.GetOrAdd(TKey key, Func`2 valueFactory) +72
System.Data.Entity.Infrastructure.DefaultManifestT okenResolver.ResolveManifestToken(DbConnection connection) +180
System.Data.Entity.Utilities.DbConnectionExtension s.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +56
System.Data.Entity.DbModelBuilder.Build(DbConnecti on providerConnection) +43
System.Data.Entity.Internal.LazyInternalContext.Cr eateModel(LazyInternalContext internalContext) +62
System.Data.Entity.Internal.RetryLazy`2.GetValue(T Input input) +123
System.Data.Entity.Internal.LazyInternalContext.In itializeContext() +611
System.Data.Entity.Internal.InternalContext.Create ObjectContextForDdlOps() +17
System.Data.Entity.Database.Exists() +36
System.Web.Providers.ModelHelper.EnsureDatabaseCre ated(DbContext db) +44
System.Web.Providers.ModelHelper.CreateMembershipC ontext(ConnectionStringSettings setting) +86
System.Web.Providers.DefaultMembershipProvider.Mem bership_CreateUser(String applicationName, String userName, String password, String salt, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, DateTime& createDate, Boolean uniqueEmail, Int32 passwordFormat, Object& providerUserKey) +51
System.Web.Providers.DefaultMembershipProvider.Cre ateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +823
System.Web.UI.WebControls.CreateUserWizard.Attempt CreateUser() +304
System.Web.UI.WebControls.CreateUserWizard.OnNextB uttonClick(WizardNavigationEventArgs e) +110
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source, EventArgs e) +401
System.Web.UI.WebControls.CreateUserWizard.OnBubbl eEvent(Object source, EventArgs e) +119
System.Web.UI.WebControls.WizardChildTable.OnBubbl eEvent(Object source, EventArgs args) +16
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +114
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +159
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212
 
Old November 3rd, 2014, 05:28 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Looks like both your connection strings are missing a password attribute.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
dksellou (November 3rd, 2014)
 
Old November 3rd, 2014, 05:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> P.S. Are you sure it is 744 and 751? I have the begining aspnet 4.5

You're right. It's 757 and 763 in that version.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
dksellou (November 3rd, 2014)
 
Old November 3rd, 2014, 10:42 PM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default

It worked!!!
you are (always) right!
THANK YOU!!!!!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
testing locally but using remote connection string JezHarvey BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 August 12th, 2008 07:28 AM
Remote Connection to SQL Server asharkashif Visual Studio 2005 1 November 24th, 2007 12:11 PM
Remote database connection tdaustin Classic ASP Databases 0 November 28th, 2005 11:28 PM
Remote connection to a MySql database. Major Sahimi MySQL 2 May 14th, 2005 06:09 AM
Remote connection to a MySQL database. Major Sahimi PHP How-To 2 July 9th, 2003 10:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.