IIS7 on Vista and SQLExpress problem

Discussion in 'ASP .Net' started by Guest, Sep 6, 2007.

  1. Guest

    Guest Guest

    Hi,

    I wonder if someone could shed some light on this one for me.

    I have developed a web app in VS2005 with the built in server. It uses an
    sql database, everytihng works.

    I need to test it across the network, so i've installed IIS7 on my Vista
    machine and created a new website, point at the website's directory. After I
    switched to the 'Classic .net' app pool, it shows up on the port.

    However, the SQLExpress database is giving me an error...

    "An attempt to attach an auto-named database for file ...\thepoint.mdf
    failed. A database with the same name exists, or specified file cannot be
    opened, or it is located on UNC share."

    The file in question exists, and the whole website directory has Everyone
    Full Control permissions, with permission inheritance on, so that should be
    fine.

    The Visual Studio isntance of this isnt running (im not running visual
    studio, the development server, or anything).

    My web.config specifies the |DataDirectory|, and my file is in App_Data - in
    fact, the database works fine when I run it through VS/Dev Server for
    debugging, but it fails on IIS7.

    What's going on?!! (and yes, my connection string does specify User
    Instance=True.

    Any help much appreciated.

    Thanks



    Dan
     
    Guest, Sep 6, 2007
    #1
    1. Advertisements

  2. Guest

    Guest Guest

    I believe this is because the auto-attach feature of SQLEXPRESS only works
    for local connections. You will probably need to permanently attach the MDF
    database file using the SQLExpress Manager or the appropriate T-SQL Command.
    Peter
     
    Guest, Sep 6, 2007
    #2
    1. Advertisements

  3. Thanks for Peter's input.

    Hi Dan,

    My understanding is after you create new website virtual dir on the Vista
    IIS7 box, it still point to the web application directory on original
    development machine, through a UNC share. Is this your case?

    If so, the error may be caused by the SQL Express database file is on
    remote location. I suggest you perform the following test:

    ** copy the entire website to a local physical directory on the vista box
    and configure IIS to use the local locaiton to test

    ** Or as Peter suggested, you can consider directly attach the database
    file to the SQL Express instance on VISTA and let your asp.net application
    (modify connectionstring) connect that attached database to see whether it
    works.

    If there is any other finding, please feel free to post here also.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Sep 7, 2007
    #3
  4. Guest

    Guest Guest

    Hi Steven,

    Unfortunately, there is no UNC share involved - that's why I don't
    understand it too well. VS, the website, the mdf, IIS7, firefox... all on the
    C: drive of my laptop (Vista Ultimate).

    Peter's suggestion sounds like it would break the SQL database in Visual
    Studio? I still want to be able to run the site from VS as well for debugging
    purposes.

    Is it possible to make all this work, all I wanted to do was test my site in
    IE6 :(
     
    Guest, Sep 7, 2007
    #4
  5. Thanks for your reply Dan,

    Don't worry, we can try locating the problem step by step. I suggest you
    try make the SQL Express database attached into the SQLExpress instance or
    any other instance temporarly for test to see whether it works. If it
    works, we can make sure that the problem just focus on the database
    connection's establishment.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.


    --------------------
     
    Steven Cheng[MSFT], Sep 12, 2007
    #5
  6. Hi Dan,

    Any progress on this issue? Please feel free to post here if you need any
    help on this.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------
     
    Steven Cheng[MSFT], Sep 14, 2007
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.