Can't get my site live!

Discussion in 'ASP.NET / ASP.NET Core' started by tcorneto, Nov 27, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Directly above my connectionString is the following line:


    <remove name="LocalSqlServer"/>
    Is that what you're referring too? Do you think this is the problem?

    Thanks!
     
  2. At the beginning of your root web.config do you see a section like this?

     
  3. wisemx thank you! You solved that problem now I seem to be onto my next one. Getting closer here. Here is the error message I got after making the change you suggested:



    Object reference not set to an instance of an object.


    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.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:





    Code:
    Line 145:
    Line 146:	Public Shared Function GetSiteSettings() As SiteSettings
    Line 147:		Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Personal").ConnectionString)
    Line 148:			Using command As New SqlCommand("site_GetSiteSettings", connection)
    Line 149:				command.CommandType = CommandType.StoredProcedure
    Source File: E:\web\cornetocom0\htdocs\App_Code\SiteSettingsManager.vb Line: 147

    Stack Trace:





    Code:
    [NullReferenceException: Object reference not set to an instance of an object.]
       SiteSettingsManager.GetSiteSettings() in E:\web\cornetocom0\htdocs\App_Code\SiteSettingsManager.vb:147
       PageBase.Page_PreInit(Object sender, EventArgs e) in E:\web\cornetocom0\htdocs\App_Code\PageBase.vb:10
       System.Web.UI.Page.OnPreInit(EventArgs e) +2057548
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +521
    



    Version Information:Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
    Do I need to put my connection stringwhere it says "Personal"in the error message?

    THANKS SO MUCH... huge help.
     
  4. Hello everyone,

    I'm new to asp.net development. I just opened an account with DASP and can't get my site running. I am using one of the starter kits (Jeremy Wadsworth) which works like a charm locally. Here is what I've done so far:

    1. Used the "Copy Web Site" in Visual Studio to upload my site.
    2. Used the SQL Tool Suite in DASP to attach my data file (MDF) to mySQL 2005 database.
    3. Changed the connectionString in my web.config to point to my database (to be certain this is correct, DASP tech support sent it to me).

    In spite of all this I'm still getting the error below. Does anyone have a clue?I don't know where else to turn here because DASP support has sent me to you guys because this is beyond their support level.

    If it helps at all this was DASP supports last email to me:

    "Although we dont provide application or development support, your application may still be referencing the old connection string somewhere. We suggest you check your application. If you need development assistance, please post to our community forum at http://community.discountasp.net/"


    Thanks in advance to whoever is kind enough to respond.
    Server Error in '/' Application.


    Configuration Error
    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

    Source Error:






    Code:
    Line 148:    <roleManager>
    Line 149:      <providers>
    Line 150:        <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    Line 151:        <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    Line 152:      </providers>
    Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 150





    Version Information:Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
     
  5. Is that a ASP.NET package you're using? i.e. Starter Kit, CMS, etc.

    Looks like you may need help from one of the DASP guys.
    Salute,
    Mark
     
  6. wisemx,

    Ya its the Jeremy Wadsworth version of the personal starter kit.
    Unfortunetly the DASP support guys will not help me because they "dont provide application or development support". They sent me herefor any help. This is exactly why I regret signing up with DASP. I'm not asking them to write code for my application, I simply want to the the thing up and running on their servers.

    I do really appreciate your input though.

    Thanks.
     
  7. Joseph Jun

    Joseph Jun DiscountASP.NET Staff

    Hi tcorneto,

    I'm sorry to hear that you've been having some problems getting your site up and running. One of the guys in support asked me to take a look at your forum post.

    Can you post the URL where you're having problems as well as your web.config file (please make sure you replace any passwords with asterisks) so that I can have a look at what might be causing the problems?

    -W

    Winston

    DiscountASP.NET
     
  8. Winston,


    Thank you so much for looking into this. My URL is http://www.corneto.com/and I've pasted my web.config file below


    Thanks!












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


    <connectionStrings>





    <!-- Connection for SQL Server 2005 -->


    <remove name="LocalSqlServer"/>


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





    </connectionStrings>


    <system.web>


    <pages>


    <namespaces>


    <clear/>


    <add namespace="System"/>


    <add namespace="System.Collections"/>


    <add namespace="System.Collections.Specialized"/>


    <add namespace="System.Configuration"/>


    <add namespace="System.Text"/>


    <add namespace="System.Text.RegularExpressions"/>


    <add namespace="System.Web"/>


    <add namespace="System.Web.Caching"/>


    <add namespace="System.Web.SessionState"/>


    <add namespace="System.Web.Security"/>


    <add namespace="System.Web.Profile"/>


    <add namespace="System.Web.UI"/>


    <add namespace="System.Web.UI.WebControls"/>


    <add namespace="System.Web.UI.WebControls.WebParts"/>


    <add namespace="System.Web.UI.HtmlControls"/>


    <add namespace="System.Data"/>


    <add namespace="System.Data.Sql"/>


    <add namespace="System.Data.SqlClient"/>


    </namespaces>


    </pages>


    <httpHandlers>


    <add type="PeterKellner.Utils.CaptchaTypeHandler" verb="GET" path="CaptchaType.ashx"/>


    </httpHandlers>


    <customErrors mode="Off"/>


    <!--<customErrors mode="RemoteOnly"/>-->


    <compilation debug="true">


    <assemblies>


    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>


    <authentication mode="Forms">


    <forms loginUrl="Login.aspx" protection="Validation" timeout="50000" />


    </authentication>


    <authorization>


    <allow users="*"/>


    </authorization>


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


    <membership defaultProvider="DefaultMembershipProvider" userIsOnlineTimeWindow="15">


    <providers>


    <add name="DefaultMembershipProvider"


    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"


    connectionStringName="LocalSqlServer"


    enablePasswordRetrieval="false"


    enablePasswordReset="true"


    requiresQuestionAndAnswer="true"


    applicationName="/"


    requiresUniqueEmail="true"


    minRequiredPasswordLength="6"


    minRequiredNonalphanumericCharacters="0"


    passwordStrengthRegularExpression=""


    passwordFormat="Hashed"


    passwordAttemptWindow="10"/>


    <!-- the AdminMembershipProvider membership provider is required in order to reset user passwords through the User Management page. -->


    <add name="AdminMembershipProvider"


    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"


    connectionStringName="LocalSqlServer"


    enablePasswordRetrieval="false"


    enablePasswordReset="true"


    requiresQuestionAndAnswer="false"


    applicationName="/"


    requiresUniqueEmail="true"


    minRequiredPasswordLength="6"


    minRequiredNonalphanumericCharacters="0"


    passwordStrengthRegularExpression=""


    passwordFormat="Hashed"


    passwordAttemptWindow="10"/>


    <!--SECURITY NOTE: The most secure passwordFormat is hashed.


    The hashed option only supports enablePasswordReset.


    If you need to enablePasswordRetrieval the most secure format is encrypted.


    Encypting your password requires a pre-defined machine key. -->


    </providers>


    </membership>


    <profile>


    <properties>


    <add name="FirstName"/>


    <add name="LastName"/>


    <add name="Website"/>


    <add name="PasswordAnswer"/>


    </properties>


    </profile>


    <roleManager enabled="true"/>


    <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">


    <providers>


    <add name="XmlSiteMapProvider" description="SiteMap provider which reads in .sitemap XML files." type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" siteMapFile="web.sitemap" securityTrimmingEnabled="true"/>


    </providers>


    </siteMap>


    </system.web>


    <system.net>


    <mailSettings>


    <smtp from="[email protected]">


    <network host="smtp.yourdomain.net" userName="yourusername" password="yourpassword" />


    </smtp>


    </mailSettings>


    </system.net>


    <location path="~/Albums/4/61.jpg">


    <system.web>


    <authorization>


    <allow roles="Family"/>


    <deny users="*"/>


    </authorization>


    </system.web>


    </location>


    <!--<location path="Downloads">


    <system.web>


    <authorization>


    <allow roles="Administrators,Registered Users"/>


    <deny users="*"/>


    </authorization>


    </system.web>


    </location>-->


    <location path="Admin">


    <system.web>


    <authorization>


    <allow roles="Administrators"/>


    <deny users="*"/>


    </authorization>


    </system.web>


    </location>


    <appSettings>


    <!-- The Album Path needs to be in the form of "~/FolderName"


    When the application creates an album to store photos in, it will create the album inside the folder


    specified here. -->


    <add key="AlbumsFolder" value="~/Albums" />


    <!-- This key specifies the folder to use for Uploads. At this time there is at least one stored procedure that


    still references the upload folder statically. Once that is changed you would be able to specify any folder


    here that the application should use for working with Uploaded photos that have not been imported to an album.-->


    <add key="UploadFolder" value="~/Upload" />


    <!-- This key defines what role a new user will be assigned to by default. If set to blank, the user will be


    created but not assigned to any roles. The user would then need to be assigned to a role by the administrator


    before they would have an special access to the website.-->


    <add key="DefaultRoleForNewUser" value="Registered Users"/>


    <!-- This key defines the theme that will be used on the admin pages. I created this setting because it will


    reduce the time it takes to create a new theme if you don't have to create all new buttons and css to go with


    administration pages. I found it easier just to have the admin sections use the White theme. If left blank the


    admin pages will use whatever theme is selected for the site. -->


    <add key="AdminTheme" value="White"/>


    <!-- This key defines the user account to be notified for all site notification. Guestbook entry, blog comments, new user, etc. -->


    <add key="NotifyAccount" value="Admin"/>


    <!-- This key defines the email address to send errors to. It is defined here in case the error is generated


    as a result of a database connection in which we would not be able to retrieve the admin email -->


    <add key="AdminEmail" value="[email protected]"/>





    </appSettings>


    </configuration>
     
  9. Joseph Jun

    Joseph Jun DiscountASP.NET Staff

    The error that I'm seeing is the following:

    Line 15: Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings('Personal').ConnectionString)

    In your web.config file, specifically within the connectionStrings, I don't see any reference to 'Personal' which is probably causing the problems. Is there any reference that was removed or is the code on line 15 supposed to reference the 'LocalSqlServer' connection string?

    Winston

    DiscountASP.NET
     
  10. Yes I changed that reference from "Personal" to "LocalSqlServer" just as a guess to try and see if it would work.


    So I changed my web.config file back to how it was:


    <connectionStrings>


    <!-- Connection for SQL Server 2005 -->


    <remove name="LocalSqlServer"/>


    <add name="Personal" connectionString="Data Source=tcp:sql2k505.discountasp.net;Initial Catalog=SQL2005_431229_personal;User ID=SQL2005_431229_personal_user;Password=*********;" providerName="System.Data.SqlClient"/>


    </connectionStrings>


    and now I'm getting the following error when you type in my URL:
    Configuration Error


    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

    Source Error:





    Code:
    Line 148:    <roleManager>
    Line 149:      <providers>
    Line 150:        <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    Line 151:        <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    Line 152:      </providers>
    Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 150
     
  11. I finally got my site working. Thanks to everyone for your help.


    Here is what I followed to get it posted:


    You probably didn't do this step correctly



    5) Open the Web.config file in VS.NET / VWD.


    Change the connection string to point to the remote SQL server.


    Comment out the orginal connection string (or just delete it if you want). By default, the starter kit uses SQL Express.


    <!--<add name="ClubSiteDB" connectionString="Data Source=.\SQLExpress;Integrated Security=true;AttachDBFileName=|DataDirectory|Club.mdf;User Instance=True" providerName="System.Data.SqlClient"/>-->


    Add the following lines


    a) This configure the club starter kit use the remote SQL server
    <add name="ClubSiteDB" connectionString="Data Source=<DB_Server>;Integrated Security=false;Initial Catalog=<DB_Name>;User ID=<DB_User>;Password=<DB_password>" providerName="System.Data.SqlClient"/>


    b) The next line overide the default setting on the server
    <remove name="LocalSqlServer"/>


    c) This line is for the membership provider. It tell asp.net to use the remote SQL server.


    <add name="LocalSqlServer" connectionString="Data Source=<DB_Server>;Integrated Security=false;Initial Catalog=<DB_Name>;User ID=<DB_User>;Password=<DB_password>" providerName="System.Data.SqlClient" />
     
  12. Good job mate, thanks for posting your followup. [​IMG]
     
  13. Look further up your web.config to see what got set as LocalSqlServer
    Search for that exact name.
    Salute,
    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