How to create virtual folder in IIS for ASP.NET 2005 web project

Last post 08-13-2007 4:38 AM by pkarthik8. 3 replies.

Sort Posts:

  • How to create virtual folder in IIS for ASP.NET 2005 web project

    08-10-2007, 3:38 AM
    • Member
      1 point Member
    • pkarthik8
    • Member since 05-22-2007, 3:03 AM
    • Posts 7
    I have installed VS 2005 and created a web application as file system and i'm using SQL 2003 database in another machine and when i run my project its going fine. (Connecting to db)Now i created a virtual folder in IIS and mapped my web project folder to it. ( "http://localhost/Test/" )Now when i access my application thru the address its throwing Server Error  (i have VS 2003 also in my machine)i don't want to connect to SQL 2005. Any settings have to be done in IIS ??Thankz in advance.

    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)

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

    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.

      

     

  • Re: How to create virtual folder in IIS for ASP.NET 2005 web project

    08-10-2007, 4:50 AM

    You topic and your error look different. Please specify whats the issue.

    Your error is to do with your application unable to connect to SQL server

    Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
  • Re: How to create virtual folder in IIS for ASP.NET 2005 web project

    08-13-2007, 4:12 AM
    Answer

    Hi pkarthik,

    From your description, I understand that after creating virtual directory for the existing web project, the web site failed to connect to the SQL Server 2005. However, debug the project in Visual Studio works well. If I have misunderstood your concern, please let me know.

    Based on my experience, the most likely cause of this issue is the login account. When view the page through IIS, the build-in account: “ASPNET” account (for IIS 5) or “Network Service” account (for IIS 6) will fail to connect the SQL Server.

    To fix this issue, you can choose one of the solutions:

        1. Change the Authentication Mode to SQL mode in connection string, for example:

    Data Source=ServerAddress;Initial Catalog=database;Integrated Security=True
    Data Source= ServerAddress;Initial Catalog=database;User ID=***;Password=*****

        2. Use ASP.NET impersonation.

    ASP.NET Impersonation 
    http://msdn2.microsoft.com/en-us/library/xh507fc5(vs.80).aspx

        3. Add build-in ASP.NET account in SQL Server logins.

    In SQL Sever Management Studio, expand “Security” node, right click “Logins” node and select “New Login…”. Add “machineName\ASPNET” or “machineName\Network Service”

     

    Sincerely,
    Benson Yu
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
  • Re: How to create virtual folder in IIS for ASP.NET 2005 web project

    08-13-2007, 4:38 AM
    • Member
      1 point Member
    • pkarthik8
    • Member since 05-22-2007, 3:03 AM
    • Posts 7

    Hi Benson Yu,

    Thankz a lot ur reply helped me and i chosed second option (impersonation) and it worked perfectly.

    (FYI i'm not using local 2005 SQL Server, I'm connecting to 2003 SQL Server located in another machine)

    Once again Thankz

    Regards,

    Karthik

     

Page 1 of 1 (4 items)