User/Role Database (ASPNETDB.MDF) won 't work when site is unploaed

Discussion in 'Databases' started by Arxaios, Jul 14, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a site with user role management which works fine in my local computer.

    The problem is that when I uploaded the site, I got the following error :

    -------------------------
    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)
    --------------------------


    Of course I have uploaded the database (ASPNETDB.MDF) in my App_Data Folder.
    Do I have to attach this database to the server?
    Do I have to use my SQL2005 database (which works fine) for the user/role management thing?

    Please Help me, I am a newbe and I have no idea what to do.

    Thanks
     
  2. Hi,

    This sounds very like the question I asked yesterday in another thread: http://community.discountasp.net/default.aspx?f=16&m=12017

    It seems a number of us are wondering whether or not we can use the same database for both Roles/Profiles and Application Data. I guess it shouldn't matter on the face of it, but perhaps if a userbase grows to thousands then it might start becoming an issue? I suppose you could always seperate out the data into two databases then.

    I suppose it also depends on how complex your user profiles are. If you are serialising complex shopping carts and the like then perhaps, again, performance might become an issue sticking it all in one database?

    This must be a common issue which others have come across. Anyone got any ideas?
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    I do not see why you can't put your data as well as the User/Role database in the same physical database.

    It should not create any problem unless you have name conflicts on tables or any SQL objects (which is very unlikely).

    See http://kb.discountasp.net/article.aspx?id=10413 for complete details.




    Post Edited By Moderator (Joel Thoms) : 7/18/2006 9:31:25 PM GMT
     
  4. Thanks kkarasin for your answer.

    Unfortunately I cannot attach my Database since I have all my data in the 'already-attached' database hosted in DiscountASP.net.

    Well my site is working fine when I run it locally.
    I just applied the built in users & security Configuration and of course VS2005 created a new Database in my local app_data folder.
    For all the other data my site is successfully connecting to my remote database hosted at discountasp.net (sql2005 database).
    So I have 2 databases. One hosted in my computer, and one hosted at discountasp.net.
    But when I upload the site (with the security/login database as well) it does not work. It probably won 't let the 2nd database to attach as well.

    My question is this :

    How can I configure my Users/Security Database to use my Remotely Hosted Database and not to create a new local database in my app_data folder?
    Actually I want to have only 1 database for both my data and my users/passwords etc.


    Thanks for your help.
    Really appreciated.
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    put "tcp:" in front of the server name to force the application to connect via TCP/IP.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. Unfortunately I'm not quite at that stage myself just yet. The questions I am asking here now are forward planning for when I do upload my site to DiscountASP.


    I was planning to handle development, including creating users and roles, locally on my VWD machine, populating the Roles tables in SQL Server 2005 Express. Then I was going to upload the whole database, application tables and Roles tables etcallin one. Could you perhaps do the same, creating your users / roles locally and then uploading the relevant bits of the database?


    I have also read that the objects for handling roles are easily exposed and used, so perhaps you could create what you need programmatically? I think the 'Membership' class handles all this.
     
  7. Hmm! I just posted that reply to a post by CARMCK. However, once I submitted the post CARMCK's post vanished! Most strange!

    Anyway, CARMCK was having an issue with managing Roles on a DiscountASP.net Database and that is what I was replying to.
     
  8. I did post a question but then found an answer in article 10413 so I deleted it, therefore 'poof it's gone'... it was not your imagination.


    Hopefully Ican help yououtwhen I get past this error:


    Step 5 in the 'how to configure the asp.net 2.0 membership/roles provider to use sql 2000 or sql 2005" article throws this error:


    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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    Anyone?
    ck
     
  9. Bruce

    Bruce DiscountASP.NET Staff

  10. [​IMG]

    I successfully updated roles and membership dataon the discountasp.net sql server 2005 server using VWD!

    For future reference, article 10413 works like a charm but first of all refer to article 10381 to enable TCP/IP clients. Also, when you enter the connectionstrings in step 3, for data sourceput tcp: before the sql server name. Lastly, I added this (optional?)to web.config: <roleManager enabled="true" />

    This forum is great - thanks for helping me get up and running.

    ck
     
  11. Hi,

    I have the same case. Can anyone please help me? I'm so desperate. I've tried many days to fix my problem.
    I've also read all the related articles. I still can't solve my problem.

    I got this error.
    Server Error in '/' 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)


    Here's my web.config:
    ==============

    <configuration xmlns='http://schemas.microsoft.com/.NetConfiguration/v2.0'>
    <connectionStrings>
    <remove name='ConnectionString1' />
    <add name='ConnectionString1' connectionString='Data Source=tcp:mblahblah.discountasp.net;Persist Security Info=True;User ID=SQL2005_12345_personal_user;Password=Bilibalah' providerName='System.Data.SqlClient'/>
    </connectionStrings>
    <system.web>
    <authentication mode='Forms' />
    <roleManager enabled='true'/>
    <compilation debug='false'/></system.web>
    </configuration>


    After uploading ASPNETDB.MDF to dir \App_Data, I used DiscountASP.net SQL Tool Suite to attach the data file (MDF). No luck yet.
    Anyone, please..... assist!



    Johnson
     
  12. You getting the error because 'ConnectionString1' is not being used by your membership/role provider since it uses 'LocalSqlServer' connection string by default. which points to SQL Express database.So you can either rename 'ConnectionString1' to 'LocalSqlServer' or have 'ConnectionString1' as your default connectionstring.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  13. It works now. Thanks!
    BTW, if I don't want to use the default 'LocalSqlServer', which part of the configuration I have to modified?


    Johnson.
     
  14. ASPNETDB.MDF does not work. How to set a connectionstring as default?

    I also got the login/secure database ASPNETDB.MDF problem just like the problem described in this thread. I have set a connectionstring which points to the application data in my web.config. My question is: how can I set a connectionstring as a default connnectionstring?
     
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