Solved

Problems copying a Web Service Project.

Posted on 2002-07-11
14
843 Views
Last Modified: 2012-06-21
I’m a rookie to .Net and don’t understand the file structure.  I can’t seem to copy a Web Service to my current machine or another machine on my network.  I’m confused.

I have a project called WbService01.  I open it up.  I then go to Project/Copy Project on the menu.  
     Destination Project folder:  http://localhost/a_Test1/WbService/
     Web Access method:          FrontPage
     Copy                       All project files

I then click OK and get a message

“Unable to create Web project ‘a_Test1/Copy of WbService’.  Server error: ‘a_test1’ does not refer to a page or folder in this web.  It may be a page or folder in a subweb, or it could be a badly formed URL.

If I go to IIS services, I have --> Default Web Site\Webpub\a_test1\WbService    

--------
If I do the above, but change the Web Access method: from FrontPage to File Share, it will save the project, but when I try to open it I get the following error:

The Project you are trying to open is a Web project.  You need to open it by specifying URL Path.

I would like to make copies before I make major changes, I hope someone can tell me how to make copies on my machine and how to move copies over to my laptop.

Thanks in advance for any help.
LJG
0
Comment
Question by:LJG
  • 6
  • 4
  • 3
  • +1
14 Comments
 
LVL 1

Expert Comment

by:gallo47
ID: 7147523
0
 
LVL 4

Accepted Solution

by:
kpkp earned 100 total points
ID: 7148548
When you create a new web service project using VS, you specify a location and name for the project.  By default this name is:

http://localhost/WebService1

(or WebService2, WebSerivce3 or whatever).  When you click OK and create this project, you are actually creating a new virtual directory in IIS, under the 'default web site'.  By default this is c:\Inetpub\wwwroot.  This new virtual directory is mapped to a new 'actual' directory in c:\Inetpub\wwroot.  Both the virtual directory and 'actual' directory should have the same name as the project (WebService1).

Find the WebService1 folder under c:\Inetpub\wwroot and copy the entire contents to the other machine.  Copy it to a folder with the same name, in the same place.  

Finally, go into Internet Services Manager on the other machine, find the directory in the explorer, right click on the folder - choose properties and click 'create'.  Close Internet Services Manager and try and open the project in VS.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7148762
Also make sure that .Net framework is installed on the production server! And aspx is enabled!
0
 
LVL 2

Author Comment

by:LJG
ID: 7149677
kpkp, we are almost there I think.  

When I follow your instructions everything works well until I try to do your last step in the Internet Services Manager.  I can’t see my directory.  So instead, I right click on Default Web Site, pick New, and Virtual Directory, then I follow the steps to create a new virtual directory and I can see it.  But I still have a problem.

I get a new error when I try to run the service:
--------------------------------------------------------------------------------
   Server Error in '/a_Test1' 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 23:           "Forms", "Passport" and "None"
Line 24:     -->
Line 25:     <authentication mode="Windows" />
Line 26:
Line 27:

Source File: C:\VB_Net\a_Test1\WbService01\web.config    Line: 25
--------------------------------------------------------------------------------

I can open the config file in the project and don’t see anything wrong with line 25 – Any help would be greatly appreciated.

Thanks
LJG
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7149803
Go to the properties of the virtual directory and click on "create application". (button at the bottom).

CJ
0
 
LVL 4

Expert Comment

by:kpkp
ID: 7149895
CJ_S is right, see my original answer for the same step.  The button on the virutal directory properties form is actually called 'create', it's the third button up - next to the text box and label 'Application name:'
0
 
LVL 2

Author Comment

by:LJG
ID: 7149955
kpkp, Thanks.  It worked for me.  The points are yours.  CJ_S thanks for your help too.  You have 50 points I’ve given you on a new question.

I do have a follow up question though, If I wanted to copy WebService1 to WebService2 on my same machine, do you have a way to do it?

Thanks for all the help, LJG
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Expert Comment

by:kpkp
ID: 7149975
You can, simply copy the files to a new folder in wwwroot, and create a new virtual directory etc.  You might want to rename the .asmx.cs files to reflect the new web service name - along with the class names inside the .cs file
0
 
LVL 2

Author Comment

by:LJG
ID: 7150131
kpkp
If you can help me get the copying to my local machine to work it’s worth an extra 50 points to me.  If you want to back off, I understand that.  My problem is that I need a better understanding of what’s happening.


I did what you suggested, but didn’t rename the .asmx.cs files to reflect the new web service name - along with the class names inside the .cs file because I could not load the new project.  I got the following error.

(The project and folder I copied=WbService      the project and folder I copied to = abc)

Unable to open Web project ‘WbService’.  The file path ‘C:\abc’ does not correspond to the URL ‘http://Localhost:/WbService’.  The two need to map to the same server location.  HTTP Error 404:  Object Not Found.

Again, any help would be appreciated.
LJG
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7150153
Open WebApplication1.csproj.webinfo In here change the following lines:

<VisualStudioUNCWeb>
    <Web URLPath =
"http://localhost/works/WebApplication1/WebApplication1.csproj" />
</VisualStudioUNCWeb>

CJ
0
 
LVL 2

Author Comment

by:LJG
ID: 7150376
CJ S

I tried your solution without success.  I even went further and was able to move a little further by doeing the below.  I still ended up with the same error as above where it showed lines 23 to 27 in the error message.  However the "Create application" button didn't solve the problem this time.

any thoughts
LJG


1) I renamed WbService.vbproj.webinfo  to  abc.vbproj.webinfo - opened WbService.vbproj.webinfo. in notepad  and changed
http://localhost/WbService/WbService.vbproj
http://localhost/abc/abc.vbproj

2) I renamed  WbService.sln to abc.sln  - I opened WbService.sln in notepad  and changed
http://localhost/WbService/WbService.vbproj
             http://localhost/abc/ABC.vbproj

2) I renamed WbService.vsdisco   abc.vsdisco    - opened up in notepad and renamed all WbService to abc

3)  I renamed WBService.vbproj  to abc.vbproj
                       WbService.suo    to   abc.suo
                       WbService.sln     to   abc.sln  


Orders.asmx   Opened with notepad  changed  Class="WbService.Service1"   to  Class="abc.Service1"
Global.asax     Opened with notepad    changed  Inherits="wbService.Global"     to  Inherits="abc.Global"
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7151181
I just did a test. I create a webservice. Compiled and then copied the directory in the c:\inetpub\wwwroot to another directory. Made a new virtual directory within IIS and pointed it to the new directory.

i opened WebCopyService1.vbproj.webinfo in a texteditor and changed it to reflect the correct virtual directory.

And it works for me...

CJ
0
 
LVL 2

Author Comment

by:LJG
ID: 7155054
kpkp - Thanks for working with me.  
CJ_S - Without your help - I still wouldn't be there.  I could not get the process of coping to a different directories to work for me.  Thanks for trying.

If someone finds something they think would work to copy a webservice to a different directory on the same machine, please let me know (Larryg@kcnet.com)

This is what worked for me.

To copy to a different machine
1) Copy the folder and all contents from the 'default web site' (Usually c:\Inetpub\wwwroot) on Machine A  to the default web site' (Usually c:\Inetpub\wwwroot) on Machine B.  (Note you can change the ‘default Web Site’ on your machine by going to Tools/Options then Environment/Projects and Solutions)
 (Note you can change the ‘Location of Web project cache’ on your machine by going to Tools/Options then Projects/Web Settings)

2) Go into Internet Services Manager (also known as IIS and Internet Information Services).  Find your machine, then Default Web Site, and right click on Default Web Site, then New/Virtual Directory.  This will walk you through creating a Virtual directory (You should use the same name of the computer folder that you use for the virtual directory.)

0
 
LVL 2

Author Comment

by:LJG
ID: 7155120
CJ_S – I’m sorry, I tried it again and it worked  - Points on another question.

Thanks for all the help, LJG

To copy to a different directory on the same machine
1) Copy the folder and all contents from the 'default web site' (Usually c:\Inetpub\wwwroot\WebService1 (Or 2 ect_) to a second directory.

2) Open a copy of your solution file (eg WbService.sln) and change the following to the right location http://localhost/WbService02/WbService.vbproj

3) Open a copy of your project file (eg WbService.vbproj.webinfo) and change the following to the right location http://localhost/WbService02/WbService.vbproj


3) Go into Internet Services Manager (also known as IIS and Internet Information Services).  Find your machine, then Default Web Site, and right click on Default Web Site, then New/Virtual Directory.  This will walk you through creating a Virtual directory (You should use the same name of the computer folder that you use for the virtual directory.)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now