How to publish C# ASP.Net code on a server?

A

Anil Gupte

Hi:

I built some sample applications from Tutorials using C#.Net 2003, now I
want to put them on my server. They work fine on my local machine, but when
I put them on my Win2003 server I get the following error:

Server cannot access application directory 'E:\wwwroot\xyz.com\'. The
directory does not exist or is not accessible because of security settings.

I simply copied all my files into a subdirectory of my one of my sites. Is
there something else I need to do? I have been using ASP classic for a
while on this server, so I know the server works. In the IIS properties,
Execute Permissions are set to "Scripts only"

Thanx for your help.
 
J

Juan T. Llibre

re:
!> I put them on my Win2003 server I get the following error:
!> Server cannot access application directory 'E:\wwwroot\xyz.com\'. The
!> directory does not exist or is not accessible because of security settings.
!> I simply copied all my files into a subdirectory of my one of my sites.

There's 2 issues here.

1. You have to specifically enable ASP.NET on IIS 6.0

You can enable ASP.NET by opening the IIS Manager and scrolling down the left-hand
side to "Web Service Extensions", click once on it and look on the right-hand panel.

Click once on the ASP.NET version you want to enable, and click the "Allow" button.

2. You need to create a virtual directory in order for IIS to recognize the path.

A. Open IIS Manager by going to Control Panel -> Administrative Tools -> Internet Information Services.

In the IIS Manager, select the "Default Web Site" folder and right-click it.
Select "New" from the context menu, and then click Virtual Directory .
The Virtual Directory Creation Wizard appears.

B. Click Next.

C. In the Alias box, type a name for the virtual directory. (choose a short name that is easy to type)

D. Click Next.

E. In the Path box, type or browse to the physical directory where your application resides,
( E:\wwwroot\xyz.com\ in your case, although I'd rename that directory so it doesn't have a dot. See below )
and then click Next.

F. Choose the defaults on the next two pages.

G. Click Finish.

After you're done, you should be able to access the files in the physical direc tory
by typing : http://localhost/TheVirtualDirectoryNameYouUsedForAnAlias/some.aspx

re:
!> E:\wwwroot\xyz.com\

Additionally, I'd rename the directory so it doesn't have ".com" as part of the directory name.

You can name the directory anything you want...and any name will do.
The mapping to a domain name is done by your DNS server.
 
A

Anil Gupte

Juan:

thanx for that information. Getting it to work on localhost is not an issue.
That is working fine. I now want to deploy on my remote server which can
only be accessed by IP address or URL (e.g. http://www.icinema.com) I
checked my Web Service Extensions on my server and ASP.NET v1.1.4322 is
Allowed already. I am not using the default web site becausee I have
multiple websites set up on that server.

I looked at http://support.microsoft.com/kb/326355 "How to deploy an ASP.NET
Web application using Xcopy deployment" as well as
http://support.microsoft.com/kb/326356 "Using Copy Project..." and both
don't work. I am very familiar with the xcopy command and with FTP and all
that, so I must be missing some very basic step here.

Also, could I not just zip up the entire direrctory (I know, I don't need
all the files, but just for the sake of argument) and ftp it to my server,
then unzip it there and it should work! I have done it hundreds of times
with good old Classic ASP files. What am I missing here? It
couldn't/shouldn't be that hard.

Thanx,
 
J

Juan T. Llibre

re:
!> I now want to deploy on my remote server which can
!> only be accessed by IP address or URL (e.g. http://www.icinema.com)

On your remote server you'll have to either :

1. setup FTP access

2. install Front Page Server Extensions ( I'd try to stay away from that )

3. setup an upload directory, and upload the files one by one via asp.net and http
( I'd try to stay away from that )

4. create a setup and deployment project in VS 2003 ( either .vsi or .msi ), upload *that*
and run the executable on the remote server

re:
!> I am not using the default web site becausee I have multiple websites set up on that server.

How did you deploy the *other* websites set up on that server ?
 
A

Anil Gupte

Yes, I have tried to stay away from FrontPage - I had huge security issues
with it on my Win2k servers.

The other websites are all setup for a while using a unique IP address for
each site. None of them have an .aspx files. This is the first time I have
tried to create a web based application. I just wrote a simple Hello World
type of app and now I want to run it on my server - should it be this
complicated?

Anyway, I did what you said and created a New Web Setup Project. Into it, I
copied all the files from my Hello World project (which is all working by
the way on my localhost IIS). I did a Build Solution, then uploaded the
Websetup1.msi to the server into a directory under one website. I ran it and
just hit next all the way. It said it was installed, but I don't see the
files anywhere in the current web site. After searching all over my server,
I find them in c:\Inetpub\wwwroot\Websetup1!! But I never use that
directory! All my web sites run from under e:\wwwroot\xxxx....

Yikes! WTF do I do?
 
A

Anil Gupte

OK. I am getting closer. I realized that the ASPNET user was not listed
under Directory Properties->Security. I added that account, now I am
getting the following error:

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: 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.
Source Error:
Line 47: by Microsoft that offers a single logon and core profile
services for member sites.
Line 48: -->
Line 49: <authentication mode="Windows" />
Line 50:
Line 51: <!-- AUTHORIZATION


Any thoughts on this?
Thanx,
 
J

Juan T. Llibre

re:
!> OK. I am getting closer. I realized that the ASPNET user was not listed
!> under Directory Properties->Security. I added that account

For Windows 2003 Server, the ASP.NET account is "NT Authority\Network Service".
ASPNET is the ASP.NET account for Windows XP and Windows 2000.

re:
!> now I am getting the following error:
!> Parser Error Message: It is an error to use a section registered as
!> allowDefinition='MachineToApplication' beyond application level.

You have to create a virtual directory for your application with the IIS Manager.
 
A

Anil Gupte

Thanx, I created the Virtual Directory right after my last message, and it
worked. But, I don't have any account called NT Authority, but I do have a
group called Network Service (strangely it doesn't show up in "Local Users
and Groups" in Manage Computer).

Thanx much for your help so far.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top