A REALLY newbie question

S

SpacemanSpiff

I am trying to teach myself C# ASP .NET with VS 2005 and the Wrox book
"Beginning Visual C# 2005"

My issue is this:
How can I deploy a "website" (web services, etc...) in a folder that is not
the root level?

When I try to "publish" the site to my local IIS InetPub/wwwroot/whatever,
VS complains that is can't publish to a subfolder.

What if the stuff I'm teaching myself with isn't something I want to stick
in the root level of the domain?

I believe this question applies to the ASPX web site, as well as a web
service, since it also seems to want to be at the root level.

Any advice is appreciated.

-Scotty
 
P

Peter Bradley

SpacemanSpiff said:
My issue is this:
How can I deploy a "website" (web services, etc...) in a folder that is
not the root level?

Does this help?

http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c8885/

Basically, as far as IIS is concerned, wwwroot *is* the root. So to
deploy a Web application (Web service or Web site), all you have to do
is put the pages and associated executables in a folder under wwwroot.
Try doing this:

* Navigate to the IIS root folder, i.e. <drive>:\Inetpub\wwwroot
* Create a folder (call it 'myprog' or something) inside wwwroot
* Enter the new folder and create a new text document (call it
'myprog.html' or something)
* Type some minimal HTML into the new text document. This would do, for
example:

<html>
<head>
<title>My Prog</title>
</head>
<body>
<h1>My Prog</h1>
<p>This is my program</p>
</body>
</html>

* Save the file
* Open a browser, and in its address bar type (assuming you've used the
'myprog' folder and file names I've suggested, otherwise substitute your
own names for every instance of 'myprog' in the following):

http://localhost/myprog/myprog.html

You should see your page displayed.

The other thing that you can do, of course, is to copy the necessary
files into any old folder and tell IIS that you want to set up a virtual
directory:

Start --> Administrative Tools --> Internet Information Services

Open the 'folders' in the panel on the left so that you can see 'Default
Web Site'. Right-click on 'Default Web Site' and select New --> Virtual
Directory ...

This open a Wizard which you can follow to associate a real folder (the
one with all your files) with a virtual folder that IIS will create
under wwwroot. You can name the virtual folder anything you like.

Once you've done that, you can access your site by typing the following
into the address bar in your browser, assuming you called the virtual
directory MyVirtualDirectory and assuming you have a default page in the
real directory (e.g. default.aspx, or whatever):

http://localhost/MyVirtualDirectory

(If you don't have a default page set, you'll need to add the name of
the page (e.g. myprog.html) to the path above)

When you use the VS facilities, all you're doing is replicating the
steps above.

Sorry about being a bit long-winded.

Cheers


Peter
 
S

SpacemanSpiff

Thanks for your reply, however, you missed my question.

Yes, I can create HTML pages in subfolders all day long. That works fine.

The IDE won't let me deploy an ASP application in anything but the root
level of the web site. That is NOT what I want.

I physically moved the pages to a subfolder, and it stopped working.
I got the following 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.
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

So, how do I configure it "as an application in IIS"? My tutorial book
doesn't cover any of that. It just assumes (as does VS 2005 wizards) I
want to put all my test and tutorial code at the root level of my site.
 
N

navyjax2

You have to change the part of your .cs file that has this code:

[WebService(Namespace="http://localhost/WebServices/",
Description="This is a demonstration WebService.")]

You have to modify the URL to include the subfolder you wish to create and
place your web service into. Ensure that the permissions on the subfolder
are appropriate - for me, I just added the "Everyone" group and gave them
full control to the subfolder and any child folders because I didn't want any
permission issues. It should then it should be able to be found.

-Tom
 

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

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top