Configuration Error after publishing a web application with FTP

Discussion in 'Site Programming, Development and Design' started by iglesiae, Apr 18, 2011.

  1. Hello,
    i just published an ASP.NET MVC 3 Web Application for the first time using VS 2010, a Winhost hosting plan and an external domain, and when I try to access the site, this configuration error appears instead of my web site (in a file which is not in my application, my app runs perfectly without any errors):



    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: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

    Source Error:

    Line 15:
    Line 16: <system.web>
    Line 17: <compilation targetFramework="4.0">
    Line 18: <assemblies>
    Line 19: <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />


    Source File: E:\web\iglesiae\web.config Line: 17

    Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955


    PLEASE HELP ME!!! I HAVE NO IDEA HOW TO PUBLISH THE APPLICATION CORRECTLY AND HAVE TO SOLVE THE PROBLEM AS SOON AS POSSIBLE!!
    I think the problem is the connection to the server, because of the source file direction, which is my Path to Root in my Site Info on my Winhost Control Panel...
    ( Path to root: E:\web\iglesiae\ and
    Source File: E:\web\iglesiae\web.config Line: 17)

    THANKS,

    JOSEPHINE
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Change the framework on your Winhost Site Account from 2.0/3.5 to 4.0. Log into your Winhost control panel. Go to the Site Manager and click on .Net Framework to update the framework your application is using.
     
    Last edited by a moderator: Oct 14, 2015
  3. great! but now I have another problem!!

    thanks! that worked great!! the site is now working perfectly, BUT now I have another problem!!
    Aparently, I didn't upload the database along with the web application, and I have no idea how to do that! I followed the exact instructions that Winhost gave me on how to publish a web app using VS 2010 and FTP, and it turns out that when I want to access any of the views that need info from the Database (SQL Database referrenced in App_Data), the response is:


    Server Error in '/' Application.
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to 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: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    Source Error:

    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

    <%@ Page Language="C#" Debug="true" %>

    or:

    2) Add the following section to the configuration file of your application:

    <configuration>
    <system.web>
    <compilation debug="true"/>
    </system.web>
    </configuration>

    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

    Stack Trace:.......etc...


    PLEASE HELP ME!!!! I really have no idea how to solve this!

    Thank you!

    Josephine
     
  4. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  5. ok, I checked out the site you said, and after reading the first instruction:

    How do I restore a backup file to my Winhost database?​
    Make sure the backup file is in the /App_data directory and the name is in the following format: [DatabaseName] _backup.bak (restoration will fail if you attempt to restore a database that does not conform to this naming convention)​


    I looked at my App_Data folder and the only two things that are in there are: Database1.mdf and Matabase1_log.ldf... so there's no backup file with the above requested format in the folder!
    What can I do??

    I really appreciate the help, thanks!!!
     
    Last edited by a moderator: Oct 14, 2015
  6. Ray

    Ray

    You need to manually create a backup of your local database yourself. Do you not have SQL Server Management Studio 2008? If you do not, you will need to download it from Microsoft's website (http://www.microsoft.com) and install it on your computer. Once that is done, download your .mdf file from the web server to your computer. Attach the .mdf file to the local sql server you have on your computer and run the backup procedure against it. From there you will have the .bak file.
     
  7. I downloaded the Microsoft SQL Server 2008 Management Studio Express, and all I have is an "Import and Export Data" option when opening the program... Therefore, how do I "Attach the .mdf file to the local sql server you have on your computer and run the backup procedure against it"??
    I tried looking for something like this, but didn't find anything!

    Inside the program, the first window requests a Data Source, but it doesn't let me choose the file Database1.mdf that I downloaded from App_Data in order to attach it, if that's what you told me to do?
     
  8. Ray

    Ray

    First you'll need to download the MDF file to your personal computer where your SQL 2008 database is installed.

    Once you have done that look at this link for instructions on what to do to attach a database.

    http://msdn.microsoft.com/en-us/library/ms190209.aspx
     
  9. ok thanks!, I managed to download correctly the SQL Server Management Studio, and I attached the MDF file that I downloaded from the web server and I can see it perfectly, with all the tables and data, but when I backup the database, I get a new .BAK file associated to my database in the MS SQL program. So now, how do I get the .BAK. file into the App_Data folder in Visual Studio and into the web server??

    All I have is the backed up database in MS SQL Server!!...it´s not related in any way to my Visual Studio web application, where I publish the web site onto the web server...

    Sorry for all the troble, but I'm completely new at this and it's not at all simple...Thanks!
     
  10. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  11. By the way!!! I added the Database into the server explorer in visual studio, but it adds it as a new database, leaving me with two databases exactly the same in the server explorer, without recognizing it's the same database!

    and I know it would be just easier to add the second "copied" database (that's already in the sql server) to the app_data and just delete the first one, but Visual doesn't let me do this either! the only way I can add databases to the app_data foldier in my project is by right clicking over the app_data foldier and creating a new one from that menu...i can't seem to add a reference to a database that's in the server explorer of the same program?!
    please help!!!!! thanks...
     
  12. Sorry I just read your last post, even though I posted after you did, but I suppose I hadn't realized you responded before writing again...

    oK!! so I just did everything that the article Publishing your SQL 2008 database to the Winhost SQL 2008 Server (the last one you posted) said... and apparently it worked out fine, because after executing the Database1.mdf with "USE DB_23268_database1 GO" at the top of the page, the message said "Command(s) completed successfully."

    So now what??? I tried reading back on the older posts, but honestly I couldn't understand where I'm at right now at solving the main problem...so what's the next step?? (I'm guessing I need to point my web app to the database on the web server, assuming the database was uploaded successfully, but I'm not quite sure, and either way, have no idea how to do this??)

    THANK YOU SOOOO MUCH!!
     
    Last edited by a moderator: Oct 14, 2015
  13. One last thing! I reread some of the older posts, and I just did part of what you told me t do in post #4. I followed all these instructions:

    How do I generate (or restore) a backup of my database?
    You can generate a backup of your database that will be placed into your account and made available for download via FTP. The file created will have a .bak extension, and can be used for maintaining safety copies of your database or for use in your local development environment. Note however that the backup files are intended for restoration to our servers, and we cannot provide support for using the database backup on your local system.


    To create a database backup

    Go to the MS SQL 2008 section in Control Panel
    Click the "Manage" link for the database you wish to back up
    Click the "Backup" link

    The backup file is created in the following format: [DatabaseName]_backup.bak
    Backup will be placed in the /App_data directory (if /App_data does not exist, it will automatically be created)
    The backup process will fail if a backup file already exists in the /App_data directory. You must rename or download any existing backups before creating a new backup.


    How do I restore a backup file to my Winhost database?

    Make sure the backup file is in the /App_data directory
    and the name is in the following format: [DatabaseName]_backup.bak (restoration will fail if you attempt to restore a database that does not conform to this naming convention)

    Go to the MS SQL 2008 section in Control Panel
    Click the "Manage" link for the database you wish to back up
    Click the "Restore" link




    because now I had all the files that the article said...but when I opened the web site, the error is still there...I'm guessing I still "need to make sure you change the connection string to point to the Winhost SQL server and the database provided to you with the Winhost account. " which is what you said on post #4, right???

    If that's what I'm missing, how do you do that?

    thanks!!!
     
    Last edited by a moderator: Oct 14, 2015
  14. Ray

    Ray

    It sounds like you are getting confused with the Backup tool on your control panel as actually initiating a backup of your database that resides on your personal computer. Initiating the backup of your database that is on your personal computer has to be done through your SQL Server Management Studio.
     
  15. So i have to backup my database in my local computer through sql server management studio first? How do i do that? And what should i do after that in order to solve my problem??

    Thanks!!
    Jo
     
  16. Ray

    Ray

  17. I backed up the database through MS server, but I'm not sure if I backed it up in my pc or not, because now i can't find the file! and the program wouldn't let me change the destination folder...and also, I backed up the database which is loaded already onto the server! the one I get after connecting to the server! not really the local database eighter, right?? And the problem still persists.... I have no idea what i'm doing, is what I just did correct???

    and now....what's next??

    I reaaaallllyyyyy want to fix the problem as soon as possible! and each time I get the feeling that i'm farther away from that!
     
  18. Ray

    Ray

    Well this is hard to troubleshoot. Its not like I can tell you go here and go there and you will find the backup files you just ran your own local database. The best thing to do is to perform a search on your entire hard drive and search for *.bak. This will pull up anything with a .bak extension. Typically for SQL when you first install it the backup is normally placed in C:\Program Files\Microsoft SQL Server. By default it is placed somewhere in that folder. But I don't know how you set it up so I can only guess from this point on.
     
  19. ok! I found it, I have the backup, so what do I do with the file now?? How do I connect the web application to the database??
     
  20. Ray

    Ray

    Can you let me know what version of SQL 2008 you have again? I was just thinking, you may actually need to run the database publishing wizard to migrate your database to our SQL server.
     
  21. SQL server management studio 2008 R2
     
  22. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  23. Sorry I got confused, but apparently I DO NOT have the R2 version...here's the detail of my program:

    Microsoft SQL Server Management Studio 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    Microsoft Data Access Components (MDAC) 2000.085.1132.00 (xpsp.080413-0852)
    Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
    Microsoft Internet Explorer 7.0.5730.11
    Microsoft .NET Framework 2.0.50727.3620
    Operating System 5.1.2600


    It's not R2 right??? so that's not the problem...
     
  24. I just looked at the connection String in the web.config file in my app, and this is what it says:


    <configuration>
    <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
    providerName="System.Data.SqlClient" />
    <add name="Database1ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True"
    providerName="System.Data.SqlClient" />
    <add name="DATABASE1_MDFConnectionString" connectionString="Data Source=USER\SQLEXPRESS;Initial Catalog=DATABASE1.MDF;Integrated Security=True"
    providerName="System.Data.SqlClient" />
    </connectionStrings>


    could the problem be that i'm not pointing it to the database??

    And one other question, how can I know if the database that's in the server, uploaded in the MS SQL place, is the same database that's in my computer and that it has beel published correctly??
     
    Last edited by a moderator: Oct 14, 2015
  25. I just thought of something else that could be causing the error...how should my Package/Publish SQL properties be configured??? Right now I'm not deploying anything...
     
  26. Ray

    Ray

    Actually you have two issues right now base off what I've seen on this thread. The first issue is moving your local database to our SQL Server.

    Lets focus on this first than we'll worry about your connection string.

    To script your database look at these instructions. Another easy way to do it is to use database publishing wizard. But this is hard to find so I came up with some instructions on how to script your database manually. If you want to use database publishing wizard try looking at this kb.

    http://support.Winhost.com/KB/a694/publishing-your-sql-2008-database-to-Winhost-sql-2008-server.aspx

    Otherwise try going through these instructions.

    Open SSMS. Go to your local database and right click on it. Choose Task/Generate scripts.

    This will open the SQL Server Scripts Wizard.

    Click Next.


    In the Select Database choose the database you want to script and click on "Script all objects in the selected database". Click next.

    In the Choose Script Options mark true for options "Include If NOT Exists", "Script Data", and "Script Triigers". Click Next.

    In the Output Option choose the path you want to save the script file. The script file will have .sql extension. I suggest saving the script file on your desktop so you can find it much easier. Leave everthing else to its default state. Click Next.

    In the Script Wizard Summary review your settings, they all should be fine and click Finish.

    You should now get a file on your desktop if that is where you saved it to. It will have a .sql extension.

    To run the script that will publish your database to our SQL 2008 Server you will use SQL Server Management Studio Express or SQL Server 2008. Follow the steps below to publish the database to the Winhost SQL 2008 Server:

    Open your database in SQL Server Management Studio 2008.
    Click File/Open/File and navigate to the SQL script you just created from your SQL Server.
    Type the SQL database name provided for you in Control Panel under Site Info Manager/MS SQL 2008/Manage.
    Choose SQL Server Authentication in the "Authentication" drop down box.
    Input your database login and password from Control Panel (see #3).
    Once the script is opened, navigate to the very top of the page and type:
    USE [database name] (without the brackets)
    GO
    Click the "Execute" button.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page