Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
October 22, 2014, 02:29:49 PM

Pages: [1] 2 3   Go Down
  Print  
Author Topic: My First .NET Website: How-to Guide  (Read 69824 times)
hw15
Spacescooter Operator
*****
Offline Offline

Posts: 36



WWW
« on: June 01, 2007, 09:44:27 PM »

My First .NET Website  Help

I would like to share with you my story, for all the other beginners out there. If you are new to web or .NET, hopefully this information will be helpful to you.

The following steps outline from start to finish how to deploy an ASP.NET 2.0 website template to your Lunarpages domain.

View demo: http://starterkits.asp.net/PersonalWebsite/

You must have a Windows hosting plan with SQL Server and be able to log into your Plesk manager. Plesk can be accessed at https://yourdomain.com:8443 , with yourdomain being the name of your domain.

First, make sure your domain is configured for ASP.NET 2.0 and FrontPage support, and that your FrontPage login and password are setup. To find these settings in Plesk, click on your domain name and then the Setup icon.

1. Visual Web Developer 2005 Express (it is free)

This program is a streamlined version of Microsoft Visual Studio and it is free for everybody. It is perfect for creating .NET websites.

Download and install Visual Web Developer 2005 Express. To install, double-click the vwdsetup.exe file that you downloaded and follow the setup wizard. When running the installation, be sure also install SQL Server Express simultaneously.

Download here: http://msdn.microsoft.com/vstudio/express/downloads/

2. Personal Web Starter Kit (it is free)

This is a .NET website template that is already pre-built and ready to deploy right now. It is perfect for publishing your first .NET website with logins, photo gallery and event calendar. There are other starter kits available, such as Club, eCommerce, etc.

Download and install the Personal Web Starter Kit from Microsoft. To install, double-click the pers.vsi file that you downloaded and follow the setup wizard.

Download here: http://msdn.microsoft.com/vstudio/express/vwd/starterkit/default.aspx

These instructions have also been used to successfully install the Classifieds Site Starter Kit.

3. Create the Project

Open Visual Web Developer program and click File, then New Website. Under the list of installed templates, you should see the Personal Web Starter Kit that you just installed. Highlight it, then browse to set the location where you would like to store your new website project. Here, you can also choose to use either Visual Basic or Visual C#. Click OK to create the project, then press Ctrl+F5 to launch the website on your local computer.

Using Web Developer, run the site by pressing Ctrl+F5 or the green arrow icon. Now you can begin modifying the site and uploading photos, etc. At minimum, you must run the site at least once in order to prime the database before exporting it in the next step. You should also go ahead and create an admin account using the ASP.NET Configuration (follow the instructions on the welcome.html page within your project). Basically, click the Security tab, click Create New User and assign the role of Administrator. When you are done, we will export/import the SQL database and upload the site to Lunarpages.

4. SQL Server Hosting Toolkit (it is free)

This is a handy tool to copy your database from your computer to Lunarpages. It creates a script file that will convert the SQL Express database to SQL 2000 format for use on Lunarpages.

Download and install the SQL Server Hosting Toolkit from CodePlex (and is backed by Microsoft). To install, double-click the DatabasePublishingWizard.msi file that you downloaded and follow the setup wizard.

Download here:  http://www.codeplex.com/sqlhost/Wiki/View.aspx?title=Database%20Publishing%20Wizard

You cannot export your local database to Lunarpages directly. However, you can export it to a .sql file and then import it to your Lunarpages database. First, locate the database in Visual Web Developer, Database Explorer. This particular Personal Website project includes two databases. To use the SQL Server Hosting Toolkit within Visual Web Developer, right-click on the ASPNETDB.MDF database and choose ‘Publish to Provider,’ then follow the wizard. Repeat the process for the Personal.mdf database. Now you have two new .sql files.

Additional instructions here: http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx

5. My Little Admin Tool (inside Plesk)

In this example, we will import both .sql files into a single MSSQL database on Lunarpages to make things easier. This way, once you publish your Personal Website, it will use the new database you created on Lunarpages.

Within Plesk, click on your domain name, then the Databases icon. Click the ‘Add New Database’ icon and follow the wizard for adding a new MSSQL database. Next, click the ‘Add New DatabaseUser’ icon and follow the wizard. Now you have an empty MSSQL database named myDatabase with username and login as myUsername and myPassword.

Now you are ready to import the .sql files to your new myDatabase, which will recreate your Personal Website database structure and contents exactly how it was from Visual Web Developer on your local computer.

Within Plesk, click on your domain name, then the My Little Admin Tool icon. Or, go directly to: http://lesuth.lunarpages.com/mylittleadmin or http://lesuth.lunarpages.com/mylittleadmin2 .

Login with your new database username and password, myUsername and myPassword. Also, be sure to click ‘Options’ and select ‘TCP/IP’ network protocol connection in order to log in.

Within My Little Admin Tool, click Tools and then New Query. Open the .sql file in Notepad and copy and paste the text into the New Query box. Be sure to select myDatabase from the dropdown box. Click Submit and your script should run successfully. Repeat this process for both .sql files. Now your myDatabase is fully populated.

6. Connection String

Before you upload your website, you need to change your connection string in the web.config file to point to your new myDatabase on Lunarpages. Note, you need to change it back in order to run the site locally again later.

Lunarpages hosts SQL databases on different servers than where websites are hosted. Your SQL database may be located on either Castor at 209.200.235.3 or Raptor at 209.200.244.115 (newest).

Within Visual Web Developer, open your Personal Website project and modify the web.config file accordingly.

Local connection string:

<connectionStrings>
<add name="Personal" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf" providerName="System.Data.SqlClient" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />
</connectionStrings>

Lunarpages connection string:

<connectionStrings>
<add name="Personal" connectionString="Server=209.200.235.3;Database=myDatabase;User ID=myUsername;Password=myPassword;" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Server=209.200.235.3;Database=myDatabase;User ID=myUsername;Password=myPassword;" />
</connectionStrings>

I cannot tell you why you need both the Personal and the Local connection strings, as I am still new to .NET. What I do know is that we combined the original two databases into one new database. Therefore, we need to point the two separate database connection strings to the same newly created database.

Note: It appears that there is only one connection string defined in the Classifieds starter kit. Still, you must be sure to add both the Classifieds and the Local connection strings just like shown above.

7. Upload Website Files

You are almost finished. Now it is time to publish your site by uploading all the site files.

Within the Visual Web Developer menu, click Website then Copy Website. Click the Connect button and enter your domain name and login info. Once you connect, the remote files (on your Lunarpages domain) are displayed on the right panel, and your local files (on your computer) are displayed on the left panel. Like other FTP programs, files can be transfered to and from by using the directional arrow buttons in between the two panels.

In this example, we will create a new folder called myPersonalWeb on the remote site. Next, highlight all the files on the left panel and click the right arrow to upload the entire project to the myPersonalWeb folder on the remote site.

After the site is published, open your browser to view your brand new website. The address may look something like this: http://www.mydomainname.com/myPersonalWeb .

At this point it is likely that your website will display an error page. The next step will help you diagnose and solve one common error.

8. Create Virtual Directory

After you have uploaded your site and imported your database, your site may error the first time you try to view it on the internet. Below is a common error and solution.

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: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

If you receive an error similar to this, you should create a virtual directory and configure it as an application in Plesk.

Within Plesk, click on your domain name, then the Web Directories icon. Click the ‘Add New Virtual Directory’ icon. In this example, we will name the new virtual directory the same as the folder that your website was published to, myPersonalWeb, and we will point to httpdocs/myPersonalWeb. Click OK, and then agree to the message that your physical folder will be converted into a virtual directory.

9. Test Website

Open your browser and view your website. The address may look something like this: http://www.mydomainname.com/myPersonalWeb . Now your website should display properly. It should look exactly like it did from Visual Web Developer on your local computer.

This concludes the how-to steps for creating your first .NET website.

If you need to later modify or update your website or database from Visual Web Developer on your local computer, you may do so. Then, all you need to do is publish your site files again and also create new .sql files and import them into your Lunarpages database.

I hope this information was helpful.

 Clapping

Good luck,

Holly



« Last Edit: April 08, 2009, 10:38:38 PM by hw15 » Logged

Web development and consulting by Internet ArchiTECH.
kilaana
Newbie
*
Offline Offline

Posts: 3


« Reply #1 on: June 15, 2007, 11:13:19 PM »

Wow!  A thousand thanks!  This was a huge help to me (an ASP.NET newbie) in getting my site published. 

There were lots of little stumbling blocks that would have taken me forever to figure out if not for your handy dandy guide!  Thanks for taking the time to write it.

- Jill
Logged
hw15
Spacescooter Operator
*****
Offline Offline

Posts: 36



WWW
« Reply #2 on: June 16, 2007, 06:10:57 AM »

I am glad to hear that this guide helped you. Does that mean that I didn't leave out any important steps? Congrats on getting your site published. You are on your way to becoming a pro!  Razz Way to go!
Logged

Web development and consulting by Internet ArchiTECH.
xXx butane xXx
Newbie
*
Offline Offline

Posts: 4



« Reply #3 on: July 16, 2007, 05:59:43 AM »

 Bouncin for Joy  Holly - I just found your post and I can't wait to try it tonight when I get home.  I've been in a 4 week rut of having my membership site working on my home pc and not on lunarpages.  Thank you for taking the time to post this - I'm just sorry that I didn't find it sooner.  I'll let you know how I do.
-dave
Logged
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12641


WWW
« Reply #4 on: July 16, 2007, 07:11:18 AM »

Very nice guide indeed!  Applause
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
hw15
Spacescooter Operator
*****
Offline Offline

Posts: 36



WWW
« Reply #5 on: July 16, 2007, 08:12:21 AM »

Hi xXx butane xXx, thanks for the comment. I am very curious to find out if the guide helps you get your website working. Keep in touch. 

Good luck!  Thumbs Up
Logged

Web development and consulting by Internet ArchiTECH.
xXx butane xXx
Newbie
*
Offline Offline

Posts: 4



« Reply #6 on: July 19, 2007, 04:22:43 PM »

Happy Happy Joy Joy
Well I got it to work - yeah!  Thanks again Holly(HW15), the instruction are great!

Since you asked earlier for some feedback on the post I took notes as I followed along.  Here are some of the thoughts (and a couple of questions) that I had while doing this.

-(under step 3): I've heard that for the Database Publishing Wizard to work the database needs to be located on the c: (or some non-user-specific section of the computer)  Haven't verified but I remember getting beeped for that once before.  So, I would just specify saving the starterkit to the c:.

-(under step 5): I wasn't sure of what to make of the mile long list of 'messages' that resulted after I submitted the t-sql file as a query.  So I stopped (thinking the red font were errors) and researched this before going forward.  I learned (which yall already know probably) that the first thing the query does when it runs is wipe out any data in the existing objects before writing over with new data.  When there isn't a object to wipe clean it posts an message.  I would just note that this is normal for the "object not found" message to pop up.

-(under step 7): when you upload the website I wasn't sure if I still needed to upload the contents of the app data folder.  I realize that at this point I just recreated the database on regor, but I did't know if I should upload the app data folder.  I uploaded it anyways (figured it couldn't hurt) but plan on deleting it just to see if it blows up my site.  If you can comment on whether or not the app data folder can be excluded from the upload process I would learn something.

-(under step 8 ) I actually messed up and uploaded directly into httpdocs, although I did create another virtual directory.  Before moving all of the files into the virtual directory, I was currious and tested to see if it worked and it did, so I'm not sure that this part is required - and from reading other posts, I'm not sure if others really want to put their entire site in a subfolder.

Well, that's probably enough typing for now.  I hope this is useful feedback.
-dave
« Last Edit: July 20, 2007, 04:50:17 AM by xXx butane xXx » Logged
hw15
Spacescooter Operator
*****
Offline Offline

Posts: 36



WWW
« Reply #7 on: July 21, 2007, 08:35:21 PM »

That is great news! So glad that you got the site working.  Happy Happy Joy Joy

Thanks a bunch for the feedback. It will be very useful to everybody.

Keep in touch Dave!  Soooo Cool
Logged

Web development and consulting by Internet ArchiTECH.
ghost181
Newbie
*
Offline Offline

Posts: 2


« Reply #8 on: August 07, 2007, 06:30:17 PM »

Sorry i am new here. i follow the guide until last step but the following error come out, anyone can teach me how to solve it.

Quote
Server Error in '/WebSite1' 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: 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:

Line 5:     Sub Application_Start(ByVal sender As [Object], ByVal e As EventArgs)
Line 6:        AddHandler SiteMap.SiteMapResolve, AddressOf Me.AppendQueryString
Line 7:        If (Roles.RoleExists("Administrators") = False) Then
Line 8:           Roles.CreateRole("Administrators")
Line 9:        End If


Source File: D:\Inetpub\vhosts\goeatout.info\httpdocs\WebSite1\global.asax    Line: 7

Stack Trace:

[SqlException (0x80131904): 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)]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739123
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +685966
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +109
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +349
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197
   System.Web.Security.SqlRoleProvider.RoleExists(String roleName) +482
   System.Web.Security.Roles.RoleExists(String roleName) +242
   ASP.global_asax.Application_Start(Object sender, EventArgs e) in D:\Inetpub\vhosts\domainname\httpdocs\WebSite1\global.asax:7
« Last Edit: August 07, 2007, 06:54:39 PM by ghost181 » Logged
ghost181
Newbie
*
Offline Offline

Posts: 2


« Reply #9 on: August 07, 2007, 07:58:39 PM »

ok solve my problem. jz change my database server ip address then solve.
Logged
tezzii
Newbie
*
Offline Offline

Posts: 2


« Reply #10 on: November 30, 2007, 04:34:29 AM »

Great text about the first .NET site I must say!
I'm still having a bit of trouble though.... I get this text:


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


Line 194:         Using command As New SqlCommand("GetNonEmptyAlbums", connection)
Line 195:            command.CommandType = CommandType.StoredProcedure
Line 196:            connection.Open()
Line 197:            Dim list As New Generic.List(Of Album)()
Line 198:            Using reader As SqlDataReader = command.ExecuteReader
 

Source File: D:\Domains\tezzii.se\wwwroot\App_Code\PhotoManager.vb    Line: 196 "

Does somebody have any ideas?
Logged
hw15
Spacescooter Operator
*****
Offline Offline

Posts: 36



WWW
« Reply #11 on: November 30, 2007, 11:20:40 AM »

Hello, congratulations on getting this far with your .NET site.  Smiling 

The error sounds like there may be a problem connecting to your database, possibly. Which step you were on when you received the error? Are you running the website and/or database locally or on a remote host? What does your connection string look like?

Please provide more details so we may better help you get past this issue.

Best regards,
HW15
Logged

Web development and consulting by Internet ArchiTECH.
tezzii
Newbie
*
Offline Offline

Posts: 2


« Reply #12 on: December 10, 2007, 03:19:59 AM »

Thanks! *smile*
Well, I have it on a remote web hotel, but I think I got it right. I gave up that day, and just left it as it was, and now I get this error instead. Think I'm starting to pull my hair soon... *sigh*


[InvalidOperationException: The type specified in the TypeName property of ObjectDataSource 'ObjectDataSource1' could not be found.]
   System.Web.UI.WebControls.ObjectDataSourceView.GetType(String typeName) +1305687
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1936
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   System.Web.UI.WebControls.FormView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.FormView.EnsureDataBound() +163
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +41
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Logged
Siamese71
Trekkie
**
Offline Offline

Posts: 11


WWW
« Reply #13 on: April 09, 2008, 10:28:52 AM »

How does this guide apply to using Plesk to install DotNetNuke? I have tried to install it numerous times without success.
Logged
BigBear101
Space Explorer
***
Offline Offline

Posts: 6


« Reply #14 on: April 18, 2008, 02:25:48 PM »

If you don't work for LunarPages, I hope they pay you something for explaining to 5,500 + of us the basics of working with LunarPages in clear language.
Logged
Pages: [1] 2 3   Go Up
  Print  
 
Jump to: