Having trouble moving site to winhost from another company's server

Discussion in 'General troubleshooting' started by leeer333, Jun 11, 2013.

  1. I have moved all of the files and the database of my website and the first page shows up now. If I try to login though, I get an error (see below). The site works with the same database and files on the other server (the only change I made was the connection string in web.config).

    I also set the application starting point to the folder that contains my web.config file and other files etc. In doing so however, I had to change the name of the folder because it wouldn't let me choose a file name that had a dash in it (ie "-") and I'm not sure if this might cause any problems.

    Am I missing another edit that needs to be done? I don't think it's a coding problem because it works on the other server, but I don't know why it's not working. I'm very new to this....

    Here's the error message:

    Server Error in '/' Application.

    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:


    [No relevant source lines]


    Source File: App_Code.4bod_lnj.1.cs Line: 2668

    Stack Trace:


    [NullReferenceException: Object reference not set to an instance of an object.]
    MainDSTableAdapters.ResourceTableAdapter.InitConnection() in App_Code.4bod_lnj.1.cs:2668
    MainDSTableAdapters.ResourceTableAdapter.get_Connection() in App_Code.4bod_lnj.1.cs:2600
    MainDSTableAdapters.ResourceTableAdapter.InitCommandCollection() in App_Code.4bod_lnj.1.cs:2675
    MainDSTableAdapters.ResourceTableAdapter.get_CommandCollection() in App_Code.4bod_lnj.1.cs:2627
    MainDSTableAdapters.ResourceTableAdapter.ResourcesSearch(String SearchText, Nullable`1 WishItem, Nullable`1 ResourceTypeId, String FirstName, String LastName) in App_Code.4bod_lnj.1.cs:2791
    MainDSHelper.SearchResources(String firstname, String lastname, String searchText, Int32 iResourceTypeId, Boolean fWishItems) in e:\web\sharingj\App_Code\DataSets\MainDSHelper.cs:84
    Search._LoadGrid(Boolean resetPager) in e:\web\sharingj\Search.aspx.cs:35
    Search.Page_Load(Object sender, EventArgs e) in e:\web\sharingj\Search.aspx.cs:58
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +50
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
     
  2. Ray

    Ray

    First make sure your database has all the necessary objects and data. If you have membership roles provider, the database should have that uploaded to it.
    I think what is occurring in the background is that your web application is trying to instantiate the objects it is invoking with the data that is suppose to be in your database you are connecting to.
    You either are not connecting to the database or their are no data/tables in your database.
    When your web application tries to instantiate the objects it is trying to trigger no data is filling it thus you may get this error.
     
  3. All I did was backup the other database and restored it in Winhost so I'm not exactly sure how to do any of that. Any articles you could point me to?

    Thanks!
     
    Last edited by a moderator: Oct 14, 2015
  4. ComputerMan

    ComputerMan Winhost Staff

    I really hope your other hosting provider allows you to export your IIS site using IIS Manager. Because if they do then you can follow the instructions of our blog post article here: http://blog.Winhost.com/how-to-back...d-sql-databases-with-the-help-of-iis-manager/

    You will need to use IIS Manager to Export your site with your old hosting provider.

    Than you an use IIS Manager to Import your site to our web servers.

    As for the SQL database since you were able to restore it. You will than need to update the connections strings on your web application to point to our hosted SQL database.
     
    Last edited by a moderator: Oct 14, 2015
  5. I tried doing it like that but got the same error as before.

    The only thing I changed was that my site on the other server is in a subfolder so I had to move everything into a subfolder to get it to work. I tried setting the application starting point as the subfolder, but I couldn't get that working.

    Is there somewhere in the database that directs the database to the folder name?
     
  6. ComputerMan

    ComputerMan Winhost Staff

    That might be the case. Since you programmed the site to be in a subdirectory. The database might be set up to look at the application as if it was in a subdirectory. Check the database's tables and look for the subdirectory name then make the necessary changes so the application will work on the root.

    For example I know that WordPress (I know this isn't the application you're working with) but, if you created that application in the subdirectory and then try to move it to the root directory you would need to change the database with the new settings.

    You stated this: "I tried setting the application starting point as the subfolder, but I couldn't get that working."

    Did you try creating the application starting point through our control panel and it didn't work? What exactly didn't work? What error message did you receive if any?

    Please read our knowledge base article on how to use the application starting point tool in our control panel here: http://support.Winhost.com/KB/a635/what-is-the-application-starting-point-tool.aspx
     
    Last edited by a moderator: Oct 14, 2015
  7. I had two problems with the application start point. First, it wouldn't let me use the name of the folder as it was on my other site because it had a dash (-) in it. When I got rid of the dash, it worked.

    My second problem was that after I selected the folder that had all of my files in it, I didn't see the normal start page where I can log in on my website. It showed me just the standard Winhost site page. When I copied everything directly into the main directory, I could finally see the page but I can't log in.

    I can't figure out how to actually access the database and see what's in the tables. Do you have any links to pages that would explain how to do this?
     
    Last edited by a moderator: Oct 14, 2015
  8. ComputerMan

    ComputerMan Winhost Staff

    Sounds like you had our default document in the root directory of your hosting account. When you first create the hosting account our system places a default document. To resolve this you can do two things.

    Delete our default document from the directory via FTP.

    Or change the order of the default document list via IIS Manager. You would need to connect to your IIS site using IIS Manager and change the order of the default documents listed. Read our blog post article on how to configure the default document here: http://blog.Winhost.com/configuring-a-default-document/

    Yes, we have a knowledge base article that shows you how to connect to your SQL database using SQL Server Management Studio here: http://support.Winhost.com/KB/a1033/how-to-connect-to-sql-server-using-sql-server-management.aspx
     
    Last edited by a moderator: Oct 14, 2015

Share This Page