I am new to .NET. I need to create a Web Service based on the code that my predecessor left behind. I believe it is .NET 3.5. In the directory where his code resides there are the following:
[root]
->App_Code -->myWebSvc.cs -->Fetch.cs->App_Data
->Bin
-->some.dll -->someother.dllGlobal.asax
Fetch.asmx Web.ConfigI need to basically re-create his Web Service, adding some calls to the Kerberos API. My predecessor didn't leave any of the VS Solution files behind. just a folder for his web service with the contents above. When I create a new .NET Web Service project in Visual Studio 2010, I get a Service1.asmx which actually opens Service1.asmx.cs. The contents of which are nothing like Fetch.asmx, which is actually just a one-line
<%@ WebService Language="C#" CodeBehind="~/App_Code/Fetch.cs" Class="Fetch" %>
My question is, how do I re-create a .NET Web Service project and include this code that is apparently all that was used for the Fetch WS. I have no idea how, when a .NET WS is built, what gets put where. In my test project there is no App_Code directory.
Would anyone know how best to go about re-creating this project? I am r开发者_高级运维eally at a loss.
your predecessor probably created a website, not a web application. if you want to open his existing stuff, just do a file->open->website
, and then browse the the top directory containing this service and click open. perhaps that will make it make more sense.
if you just want to look at the code so you can copy/paste it, you would look at fetch.cs. it probably references the myWebSvc.cs in some way, so you'll probably want to place it in your new project as well.
This may not have been an actual Web Service Project that you're looking it. At worst it could be a Web Site with a single .asmx file.
To convert this to a Web Service Project, you can copy/paste/include the code/files from myWebSvc.cs
and Fetch.cs
. This will allow you to leverage the code that's in those 2 files, and you can refactor at will.
Ensure any appropriate 3rd assembly references in the bin
are needed, and any items in the web.config are brought over to your new project as needed.
There is a lot that is unknown about this project. I can make a few assumptions.
Like what has already been stated, it looks like this is a website not application. If you want to recreate it and use an application there are some things you should do. The dlls in the bin folder could be important and should be migrated if referenced from myWebSvc.cs or Fetch.cs. I am guessing that myWebSvc.cs is a class that Fetch.cs utilizes and should be included. You can generate an App_Code folder if you want in your new webservice but what is more important is that everything is operating in the same namespace.
Those are crucial things without seeing the code from whole project.
精彩评论