Link to home
Start Free TrialLog in
Avatar of LJG
LJG

asked on

Problems copying a Web Service Project.

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
Avatar of gallo47
gallo47

ASKER CERTIFIED SOLUTION
Avatar of kpkp
kpkp
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also make sure that .Net framework is installed on the production server! And aspx is enabled!
Avatar of LJG

ASKER

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
Go to the properties of the virtual directory and click on "create application". (button at the bottom).

CJ
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:'
Avatar of LJG

ASKER

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
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
Avatar of LJG

ASKER

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
Open WebApplication1.csproj.webinfo In here change the following lines:

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

CJ
Avatar of LJG

ASKER

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"
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
Avatar of LJG

ASKER

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.)

Avatar of LJG

ASKER

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.)