Need help identifying error in deployed site

Last post 01-11-2007 9:11 PM by wandrson. 7 replies.

Sort Posts:

  • Need help identifying error in deployed site

    01-11-2007, 5:38 PM
    • Loading...
    • wandrson
    • Joined on 01-09-2007, 5:12 PM
    • Austin, Texas
    • Posts 7

    I have used the Club Starter kit to develop an updated web site for a local user group.  I tested everything under VWD and SSEE and have deployed the site to a hosted environment consisting of an IIS and a MS SQL 2000 Server.

     As part of the transition I mapped the MSSQL Server while still using VWD to host the site.  I was able to verify that I could add events, news, and users and that the changes were reflected in the remote MS SQL 2000 database (including the aspnet membership tables).  The curious item was that the ASPNETDB.mdf keeps getting recreated every time I run the site with VWD even though it is not being updated with the data.  All functions work in this intermediate enviroment.

     When I try to run the site from the web server, I would get the ErrorHandler.aspx file displayed (though it appears to abort rendering the complete Default.master template.

     By changing the following in the web.config file

    from:

    <

    customErrors mode="RemoteOnly" defaultRedirect="ErrorPage.htm"/>

    to:

    <

    customErrors mode="Off"/>

    I get the database connection error (refered elsewhere when switch to SQL2000) only the first time the site is accessed after updating the files.  After that everthing works fine if viewed without logging in as a user.

    If you login the pages display fine except those that contain the following snippet of code:

    isAdmin = User.IsInRole(

    "Administrators")

    Those files that contain this snippet generate the following 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)

    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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    Source Error:

    Line 8:      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Line 9:          Dim isAdmin As Boolean
    Line 10:         isAdmin = User.IsInRole("Administrators")
    Line 11:         panel1.Visible = isAdmin
    Line 12:         panel2.Visible = isAdmin

    Source File: D:\www.austin-aug.com\Events_Calendar.aspx    Line: 10

    Walter Anderson
    Senior GIS Analyst/Developer
    Austin, Texas
  • Re: Need help identifying error in deployed site

    01-11-2007, 7:11 PM
    • Loading...
    • rojay12
    • Joined on 04-03-2006, 10:43 PM
    • Sacramento, CA
    • Posts 614

    post your entire web config.  are you using the correct connectionStringName? my guess is it is trying to use aspnetdb.mdf and not the club database for your roles. 

    add this to the top of your config...

    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=<YOURSERVER>;Initial Catalog=<YOURDBNAME>; UID=<YOURUSERNAME>; PWD=<YOURPASSWORD>;"
       providerName="System.Data.SqlClient" />

    ASP when installed has an entry in connection strings in the machine config for LocalSqlServer. So you need to remove it. If that doesnt help, like i said post your web.config

    Jared Roberts
    Lead Application Developer
  • Re: Need help identifying error in deployed site

    01-11-2007, 7:51 PM
    • Loading...
    • wandrson
    • Joined on 01-09-2007, 5:12 PM
    • Austin, Texas
    • Posts 7

    Here is the full web.config

     Where can I find the machine config to remove the LocalSqlServer definition you referenced.  Thanks for the help.

    <?

    xml version="1.0"?>

    <

    configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

    <

    location path="events_edit.aspx">

    <

    system.web>

    <

    authorization>

    <

    allow roles="Administrators"/>

    <

    deny users="*"/>

    </

    authorization>

    </

    system.web>

    </

    location>

    <

    location path="locations_edit.aspx">

    <

    system.web>

    <

    authorization>

    <

    allow roles="Administrators"/>

    <

    deny users="*"/>

    </

    authorization>

    </

    system.web>

    </

    location>

    <

    location path="news_edit.aspx">

    <

    system.web>

    <

    authorization>

    <

    allow roles="Administrators"/>

    <

    deny users="*"/>

    </

    authorization>

    </

    system.web>

    </

    location>

    <

    location path="photoalbum_new.aspx">

    <

    system.web>

    <

    authorization>

    <

    allow roles="Administrators"/>

    <

    deny users="*"/>

    </

    authorization>

    </

    system.web>

    </

    location>

    <

    location path="member_list.aspx">

    <

    system.web>

    <

    authorization>

    <

    deny users="?"/>

    </

    authorization>

    </

    system.web>

    </

    location>

    <

    location path="member_details.aspx">

    <

    system.web>

    <

    authorization>

    <

    deny users="?"/>

    </

    authorization>

    </

    system.web>

    </

    location>

    <

    location path="Admin.aspx">

    <

    system.web>

    <

    authorization>

    <

    allow roles="Administrators"/>

    <

    deny users="*"/>

    </

    authorization>

    </

    system.web>

    </

    location>

    <

    connectionStrings>

    <

    add name="ClubSiteDB" providerName="System.Data.SqlClient" connectionString="server=mssql2000.austin-aug.com;database=aaug_db;uid=aaug_db;pwd=password" />

    <

    add name="ASPNETDB" providerName="System.Data.SqlClient" connectionString="server=mssql2000.austin-aug.com;database=aaug_db;uid=aaug_db;pwd=password" />

    </

    connectionStrings>

    <

    system.web>

    <

    roleManager enabled="true"/>

    <

    authentication mode="Forms"/>

    <

    compilation debug="true" strict="true">

    <

    assemblies>

    <

    add assembly="System.Xml, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    <

    add assembly="System.Messaging, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

    <

    add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

    </

    assemblies>

    </

    compilation>

    <

    membership>

    <

    providers>

    <

    clear />

    <

    remove name="AspNetSqlMembershipProvider" />

    <

    add name="AspNetSqlMembershipProvider"

    type="System.Web.Security.SqlMembershipProvider"

    connectionStringName="ASPNETDB"

    enablePasswordRetrieval="false"

    enablePasswordReset="true"

    requiresQuestionAndAnswer="true"

    requiresUniqueEmail="false"

    passwordFormat="Hashed"

    maxInvalidPasswordAttempts="5"

    minRequiredPasswordLength="5"

    minRequiredNonalphanumericCharacters="1"

    passwordAttemptWindow="10"

    passwordStrengthRegularExpression=""

    applicationName="/"

    />

    </

    providers>

    </

    membership>

    <

    siteMap defaultProvider="AspNetXmlSiteMapProvider" enabled="true">

    <

    providers>

    <

    remove name="AspNetXmlSiteMapProvider"/>

    <

    add name="AspNetXmlSiteMapProvider" description="SiteMap provider which reads in .sitemap XML files." type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true" siteMapFile="Web.sitemap"/>

    </

    providers>

    </

    siteMap>

    <

    customErrors mode="Off"/>

    <

    globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

    </

    system.web>

    </

    configuration>

     

    Walter Anderson
    Senior GIS Analyst/Developer
    Austin, Texas
  • Re: Need help identifying error in deployed site

    01-11-2007, 7:56 PM
    • Loading...
    • wandrson
    • Joined on 01-09-2007, 5:12 PM
    • Austin, Texas
    • Posts 7
     
     Here is the full web.config formatted properly:
    1
    2    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    3    	<location path="events_edit.aspx">
    4    		<system.web>
    5    			<authorization>
    6    				<allow roles="Administrators"/>
    7    				<deny users="*"/>
    8    			</authorization>
    9    		</system.web>
    10   	</location>
    11   	<location path="locations_edit.aspx">
    12   		<system.web>
    13   			<authorization>
    14   				<allow roles="Administrators"/>
    15   				<deny users="*"/>
    16   			</authorization>
    17   		</system.web>
    18   	</location>
    19   	<location path="news_edit.aspx">
    20   		<system.web>
    21   			<authorization>
    22   				<allow roles="Administrators"/>
    23   				<deny users="*"/>
    24   			</authorization>
    25   		</system.web>
    26   	</location>
    27   	<location path="photoalbum_new.aspx">
    28   		<system.web>
    29   			<authorization>
    30   				<allow roles="Administrators"/>
    31   				<deny users="*"/>
    32   			</authorization>
    33   		</system.web>
    34   	</location>
    35   	<location path="member_list.aspx">
    36   		<system.web>
    37   			<authorization>
    38   				<deny users="?"/>
    39   			</authorization>
    40   		</system.web>
    41   	</location>
    42   	<location path="member_details.aspx">
    43   		<system.web>
    44   			<authorization>
    45   				<deny users="?"/>
    46   			</authorization>
    47   		</system.web>
    48   	</location>
    49   	<location path="Admin.aspx">
    50   		<system.web>
    51   			<authorization>
    52   				<allow roles="Administrators"/>
    53   				<deny users="*"/>
    54   			</authorization>
    55   		</system.web>
    56   	</location>
    57     <connectionStrings>
    58       <add name="ClubSiteDB" providerName="System.Data.SqlClient"  connectionString="server=mssql2000.austin-aug.com;database=aaug_db;uid=aaug_db;pwd=password" />
    59       <add name="ASPNETDB" providerName="System.Data.SqlClient"  connectionString="server=mssql2000.austin-aug.com;database=aaug_db;uid=aaug_db;pwd=password" />
    60     </connectionStrings>
    61     <system.web>
    62       <roleManager enabled="true"/>
    63   		<authentication mode="Forms"/>
    64   		<compilation debug="true" strict="true">
    65   			<assemblies>
    66   				<add assembly="System.Xml, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    67   				<add assembly="System.Messaging, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    68   				<add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    69   			</assemblies>
    70   		</compilation>
    71       <membership>
    72         <providers>
    73           <clear />
    74           <remove name="AspNetSqlMembershipProvider" />
    75           <add name="AspNetSqlMembershipProvider"
    76                type="System.Web.Security.SqlMembershipProvider"
    77                connectionStringName="ASPNETDB"
    78                enablePasswordRetrieval="false"
    79                enablePasswordReset="true"
    80                requiresQuestionAndAnswer="true"
    81                requiresUniqueEmail="false"
    82                passwordFormat="Hashed"
    83                maxInvalidPasswordAttempts="5"
    84                minRequiredPasswordLength="5"
    85                minRequiredNonalphanumericCharacters="1"
    86                passwordAttemptWindow="10"
    87                passwordStrengthRegularExpression=""
    88                applicationName="/"
    89            />
    90         </providers>
    91       </membership>
    92   		<siteMap defaultProvider="AspNetXmlSiteMapProvider" enabled="true">
    93   			<providers>
    94   				<remove name="AspNetXmlSiteMapProvider"/>
    95   				<add name="AspNetXmlSiteMapProvider" description="SiteMap provider which reads in .sitemap XML files." type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true" siteMapFile="Web.sitemap"/>
    96   			</providers>
    97   		</siteMap>
    98       <customErrors mode="Off"/>
    99       <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
    100  	</system.web>
    101  </configuration>
    102  
    
     
    Walter Anderson
    Senior GIS Analyst/Developer
    Austin, Texas
  • Re: Need help identifying error in deployed site

    01-11-2007, 8:01 PM
    • Loading...
    • rojay12
    • Joined on 04-03-2006, 10:43 PM
    • Sacramento, CA
    • Posts 614

    well unfortunatly if it is at a host your SOL, but you can add this to the top you your connection string list...

    <remove name="LocalSqlServer" />

    or

    <clear />

    Jared Roberts
    Lead Application Developer
  • Re: Need help identifying error in deployed site

    01-11-2007, 8:07 PM
    Answer
    • Loading...
    • rojay12
    • Joined on 04-03-2006, 10:43 PM
    • Sacramento, CA
    • Posts 614

    that remove or clear statement should work.  i hope that isnt your actual username and password in your connection string.  if so, make a request to have it changed before someone jerks with you.   let me know if that fixes it.

    Jared Roberts
    Lead Application Developer
  • Re: Need help identifying error in deployed site

    01-11-2007, 8:36 PM
    • Loading...
    • wandrson
    • Joined on 01-09-2007, 5:12 PM
    • Austin, Texas
    • Posts 7

    Thanks.  I will give it a try.

    And no, that isn't the correct ip, database name, user name or password.   I changed them to avoid publicly posting them

    Walter Anderson
    Senior GIS Analyst/Developer
    Austin, Texas
  • Re: Need help identifying error in deployed site

    01-11-2007, 9:11 PM
    Answer
    • Loading...
    • wandrson
    • Joined on 01-09-2007, 5:12 PM
    • Austin, Texas
    • Posts 7

    Added the clear and it generated a new error message.  Basically saying that the LocalSqlServer connection was no longer defined.

    I changed the name of my second connection from ASPNETDB to LocalSqlServer and this solved the problem.

     My mistake was in understanding the connection string LocalSqlServer, I thought it was a predefined string that required the SQL Express server.  I didn't realize that it could (and should) be overwritten with the new connection string for the ASPNETDB database.

     

    Anyway thanks for the help. 

     

     

    Walter Anderson
    Senior GIS Analyst/Developer
    Austin, Texas
Page 1 of 1 (8 items)
Microsoft Communities
Page view counter