database uploaded to wrong server should be in DASP SQL server>help to correct mistake!!

Discussion in 'ASP.NET 2.0' started by wisemx, Nov 2, 2008.

  1. Hi,
    Wow! Did you just down a collection of Jolt colas? [​IMG]


    (OK, this is no time for humor...)


    First thing...it's time to upgrade your versions.
    You should be using VWD2008 and SQL Express 2008 now.


    Yes the new version of SQL Express will allow you to sync local to remote.
    The previous versions did not have that feature, you could only connect to one server at a time, but not now.


    Your ASP.NET folders go in your remote sites structure, they have nothing to to do with virtual files or SQL Server objects.
    Then if you want to use the Attach feature you can place your Express DBs in the default App_Data folder.
    The Attach tool in your Control Panel can work with them from there, no prob.


    You can also get your DB objects and records on-line in a variety of ways once you upgrade to SQL Server 2008 Express.
    The easiest method will be the Export wizard, it's snazzy. (Saavy Captn Jack might say. Dang it, more humor.)


    Salute,
    Mark



    Technical Evangelist for DiscountASP.NET
    http://www.iis7test.com/webcasts/
    http://weblogs.asp.net/markwisecarver/
    http://blogs.windowsclient.net/wisecarver/default.aspx

    (Microsoft IT Usability http://msitusability.multiply.com/)
     
  2. I moved a tiny test databasepage from localhost, worked fine till I moved page to remote DASP site.
    This page contains a gridview and details view simple layoutno tables.

    I follow the following procedure to upload database objects through VWD2005 (maybe I should use SQL server mgt. studio express?):

    1st.step: x-copy ftp in iis(remote site) file app_offline.htm to shutdown site.
    2nd.step:Backup SQL database onDASP service acct. SQL server2005.
    3rd.step: Uploaded(remote site) the following folder: App_Data (aspnetdb.mdf, aspnetdb_log.ldf -&-author.mdf,author_log.ldf) folder: App_Code (dataset1.xsd -&- dataset1.xss) thru detach/attach object.
    4th.step: uninstalled app-offline.htm from project and in iis.

    But since found that I made a big mistake [​IMG]
    Big error..! So how can I correct my mistake?
    I uploaded theApp_Data and contents (aspnetdb.mdf, aspnetdb_log.ldf -&-author.mdf, author_log.ldf)to iis remote.
    Would I have to delete the App_Data folder in iis remote box or just authors.mdf.and.ldf?

    And where do I upload or place the App_Code folder? In the SQL box or in the iis box?

    If I upload via VWD2005 I guess, I would need to highlight SQL account name in my VWD2005 'database explorer' to my remote SQL server instance. And right click to Modify Connections and chose: Connect to a database and chose: attach a database file, were I browse to the objects.

    But I have a letter box that asks a "logical name" of database. What do I input here?

    I this the correct DASP procedure?
     
  3. ByASP.NET folders you mean the App_Code folder??

    and the SQL Server objects or App_Data folder are attached todatabase ??

    What if I don't use the DASP attach database tool; do you know how to DB attach in VWD2005??
     
  4. Thanks wisemx, the videos help me.


    But I'm still having problems when I click on the link to page where I have my little test DB.


    In my case it's a [default.aspx] page where I have a tiny gridview and details view objects


    I have the App_Code in remote with allsupporting files and I used the DASP DB attach tool.


    I'mwondering why if in sql server express under tables I haveall the.dbo formy [author.mdf] and I assume the .ldf was loaded correctly.


    My database page works fine under localhost but under remote it draws the error...asp.net is challenging to say the least [​IMG] the result below:


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


    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)


    Source Error:



    Line 1584: this.Adapter.SelectCommand = this.CommandCollection[0];
    Line 1585: DataSet1.StateListDataTable dataTable = new DataSet1.StateListDataTable();
    Line 1586: this.Adapter.Fill(dataTable);
    Line 1587: return dataTable;
    Line 1588: }



    Source File: c:\WINDOWS\microsoft.net\Framework\v2.0.50727\Temporary ASP.NET Files\root\4a768cc8\13ff178f\App_Code.5e4tywbx.0.cs Line: 1586


    Stack Trace:



    [SqlException (0x80131904): 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)]
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844759
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4858065
    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +376
    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4859187
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
    System.Data.SqlClient.SqlConnection.Open() +122
    System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
    System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
    System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
    System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115
    DataSet1TableAdapters.StateListTableAdapter.GetStates() in c:\WINDOWS\microsoft.net\Framework\v2.0.50727\Temporary ASP.NET Files\root\4a768cc8\13ff178f\App_Code.5e4tywbx.0.cs:1586


    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
    System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
    System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
    System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +488
    System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1247
    System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +95
    System.Web.UI.WebControls.ListControl.PerformSelect() +34
    System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
    System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
    System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
    System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +18
    System.Web.UI.Control.PreRenderRecursiveInternal() +80
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Control.PreRenderRecursiveInternal() +171
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
     
  5. Did you change your application's connection string to connect to your DiscountASP SQL database?

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. I guess it has, the only code I manually changed in web.config was:



    <customErrors mode="Off"></customErrors>


    I guess it changed when I uploaded author.mdf on sql server automatically (frankly don't know if this is correct or how toset the correct connectstrings tag-I'm lost[​IMG]
    connectionStrings is set presently at:


     
  7. Hiya...


    If that is your current conn string you do need to update it for the remote DB for your site.
    Look in your Control Panel, in the section for the SQL Server you added.
    At the bottom of the main page for that SQL Server will be the connection string you need to use.
    If you need help I'll write one for you, no problem.
    You can search for my previous posts concerning these things, I've written conn strings for a lot of Devs here.
    Salute,
    Mark




    Technical Evangelist for DiscountASP.NET
    http://www.iis7test.com/webcasts/
    http://weblogs.asp.net/markwisecarver/
    http://blogs.windowsclient.net/wisecarver/default.aspx

    (Microsoft IT Usability http://msitusability.multiply.com/)
     
  8. <connectionStrings>
    <clear />
    <remove name="LocalSqLServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2kXXX.discountasp.net;Initial Catalog=SQL2005_XXXXXX_XXX;user ID=SQL2005_XXXXXX_XXX_user;Password=XXXXXX"
    providerName="System.Data.SqlClient" />

    <remove name="SQL2005_XXXXX_XXXXX_userConnectionString"/>
    <add name="SQL2005_XXXXX_XXXX_userConnectionString" connectionString="Data Source=tcp:sql2kXXX.discountasp.net;Initial Catalog=SQL2005_XXXXX_XXXXX;Persist Security Info=True;user ID=SQL2005_XXXX_XXXX_user;Password=XXXX"
    providerName="System.Data.SqlClient" />


    <remove name="authorConnectionString" />
    <add name="authorConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\author.mdf;Integrated Security=True;User Instance=True"
    providerName="System.Data.SqlClient" />
    </connectionStrings>

    above is my connectionstring and result:

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

    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)

    I followed thepost example:


     
  9. Just to reviewmy
     
  10. Hi,
    Go back to VS/VWD and see what the conn name is for that dataset.
    The connection name is not important but it must match one of the names in your web.config conn section.
    Normally you will want to leave the LocalSQLServer even if you don't use it that can eliminate some trouble.
    Just make sure one of your other added names exactly matches that dataset.


    And notice in your conn string you are still using SQL Express for the one giving you trouble. [​IMG]
    Salute,
    Mark










    Technical Evangelist for DiscountASP.NET
    http://www.iis7test.com/webcasts/
    http://weblogs.asp.net/markwisecarver/
    http://blogs.windowsclient.net/wisecarver/default.aspx

    (Microsoft IT Usability http://msitusability.multiply.com/)
     
  11. Hi,
    The DASP SQL Servers are Web versions and they will use default settings if your connection string validates.
    Unless something odd comes up don't worry about those settings.</o:p>
    As for Key Encryption, your web.config is secure on DASP servers.
    My own personal opinion is that you don't need it here, in an Enterprise maybe but not here.
    For what it's worth there is a KB article on this:
    http://kb.discountasp.net/article.aspx?id=10477</o:p>
    Any table or object you don't need just use a Drop command, if you know SQL.
    If it's not part of a hierarchy and is not needed there is no problem in dropping it.
    Salute,
    Mark</o:p>


    Technical Evangelist for DiscountASP.NET
    http://www.iis7test.com/webcasts/
    http://weblogs.asp.net/markwisecarver/
    http://blogs.windowsclient.net/wisecarver/default.aspx

    (Microsoft IT Usability http://msitusability.multiply.com/)
     
  12. U da man wisemx [​IMG] this was good advice!

    Just wanted to clean up codeneed advice. The connectionstring belowis fine but could not helpnotice
    I didn't add the syntax: Persist Security Info=True-or- Integrated Security=True;User Instance=True is this necessary in this string??
     
  13. Hi,
    You cannot connect to your Express DB files on a DASP server.
    You can locally but not on your live site here.
    If you added a SQL Server option look in your Control Panel for the string for your account.
    Some of my webcasts already cover that part.
    It's the first thing you need when you add a SQL Server to your site here.

    If you have added a SQL Server option and still can't get past this point I'll do it for you if you want.
    Salute,
    Mark

    P.S. This is note a problem at all so don't worry about posting additional questions.



    Technical Evangelist for DiscountASP.NET
    http://www.iis7test.com/webcasts/
    http://weblogs.asp.net/markwisecarver/
    http://blogs.windowsclient.net/wisecarver/default.aspx

    (Microsoft IT Usability http://msitusability.multiply.com/)
     

Share This Page