How to connect your ASPDBNET.MDF file :: Step by Step

Discussion in 'Databases' started by sefat, Jun 9, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi,

    I have my project developed in Visual Studio 2008. i have used C# dot net and MS SQL 2005 as my database.

    Before buying this hosting at discountasp.net, i had this another hosting plan. I uploaded all my files via FTP. The mdf file is under App_Data folder. My previous hoster gave me a connection string and i replaced that in web.config file. But my website database/ dynamic pages loaded perfectly on live but i couldn't log into my Admin panel using the credentials which was working fine in localhost.

    Later, i saw this mdf attachment tool in discountasp.net control panel demo. So i bought ine year hosting plan with one year MS SQL 2005 add-on.

    Now can anyone help me with the steps on "How to attach the MDF file" ??
    What connection string should i use? etc.

    I think so many of us have faced this same problem coz i googled and found a lot of people asking help on this.
     
  2. ...Yes it appears we need to create a Webcast for this.
    I'll do my best to get one done today.
    All the best,
    Mark
     
  3. ...I've completed the Webcast for this, need to encode it and then get it on-line.
    I made sure that in the Webcast I made a few mistakes that currently happen, this way they are shown in the Webcast and I am showing how to overcome them.

    Working on it now...
     
  4. cant wait to get that ..!!
    very nice of you Mark. Appreciate it..!!:)
     
  5. ..Still editing, if I get it on-line tonight I deserve an award. ;-)
     
  6. Hi Mark, do you have any update?
     
  7. ...It's not on-line yet but I'm done with the editing.
    Encoding and getting the Smooth Streaming on-line takes about 3 hours.
    Hate to say the obvious but... soon
     
  8. thanks a lot Mark ! been waiting the whole day for watching this...now im gonna watch...hopefully my problems will be gone !
     
  9. Hopefully it covers everything.
    Note: I had some trouble encoding that one and am re-encoding right now.
    I didn't know until today that Expression Encoder v4 wasn't shipping with all of the codecs yet.
    Developers are not going to like it but the licensing has changed in v4.
    All the best,
    Mark
     
  10. Hi Mark...i just attched the mdf file...and using this following connection string:

    <connectionStrings>
    <clear/>

    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k503.discountasp.net;Initial Catalog=SQL2005_738091_******;User ID=SQL2005_738091_*****_user;Password=******;" providerName="System.Data.SqlClient"/>

    </connectionStrings>



    Now when i try to access my website's homepage that has a dynamic portion (latest news)..im getting this error:


    Server Error in '/' Application.
    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0246: The type or namespace name 'DataSetNewsTableAdapters' could not be found (are you missing a using directive or an assembly reference?)

    Source Error:

    Line 14: public partial class _Default : System.Web.UI.Page
    Line 15: {
    Line 16: DataSetNewsTableAdapters.NewsTableAdapter adapter = new DataSetNewsTableAdapters.NewsTableAdapter();
    Line 17: DataSetNews.NewsDataTable news;
    Line 18:


    Source File: e:\web\hasanandass\htdocs\Default.aspx.cs Line: 16


    Show Detailed Compiler Output:

    ..........
    .......

    ..........


    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016


    Could you please help why is this problem occuring.. ? Here is my website address:

    http://www.hasanandassociatesbd.com/
     
  11. ...Hmmmm, from first guess it looks like not all of the files are synced to the remote site.
    Have you synced all of the site folders?
     
  12. Hi Mark,
    I have sync all the files again.
    This time the error is different. Here is the link:

    http://www.hasanandassociatesbd.com/

    The connnection string im using now looks like:

    <connectionStrings>
    <clear/>
    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k503.discountasp.net;Initial Catalog=SQL2005_738091_******;User ID=SQL2005_738091_*****_user;Password=******;" providerName="System.Data.SqlClient"/>

    </connectionStrings>
     
  13. The connection string with the name 'AspnetdbConnectionString' does not exist in your web.config but your code is attempting to read it out.

    Code:
    System.Configuration.ConfigurationManager.ConnectionStrings["AspnetdbConnectionString"].ConnectionString;
    blows up because
    Code:
    System.Configuration.ConfigurationManager.ConnectionStrings["AspnetdbConnectionString"]
    returns null then next the code attempts to read the ConnectionString property of this null instance.

    You need to sort your connection strings out in the web.config
     
  14. hi,
    I have changed the connection string to this:

    <connectionStrings>

    <add name="AspnetdbConnectionString" connectionString="Data Source=tcp:sql2k503.discountasp.net;Initial Catalog=SQL2005_738091_hasanaa;User ID=SQL2005_738091_hasanaa_user;Password=abc13456;"/>

    </connectionStrings>


    My site launches perfectly. Also database items in the homepage are showing. but when i try to log in my CMS panel using my credentials its giving me this error:


    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.

    SQLExpress database file auto-creation error:

    The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:

    1. If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
    2. If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
    3. Sql Server Express must be installed on the machine.
    4. The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.



    i can post the Stack trace as well if you need to see that?

    I have worked on my project using Windows authentication in Visual Studio 2008....in Localhost (my pc) those credentials work perfectly. but i dont know whats goin on here. Could anyone please help me with this?
     
  15. can anyone please help me with this? My deadline with my client have already been passed..:(
     
  16. mjp

    mjp

    Your CMS config/connection string is looking for SQL Express which isn't supported.

    Are you using a separate database for the CMS in your dev environment?
     
  17. I developed my project using Visual Studio 2008 SP1....every database information are stored in one file called ASPDBNET.MDF..i uploaded that file using discountasp.net MDF attaching tool....i even looked into the database tables by logging via

    https://sqlwebadmin.discountasp.net/

    all the user tables, roles are there.....the dynamic pages of my site is also working fine...

    http://www.hasanandassociatesbd.com/


    but if you go to log in page....try to log in using the same credentials im using in localhost...it throws that error ive mentioned..


    Can you please give me the idea of how to get this work ?
     
  18. ...Want me to take a look at the remote code?
    If so, PM your DASP Control Panel login to me or Email it to [email protected]
    (You can trust me, I've done this for DASP accounts for years now.)
    All the best,
    Mark
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page