views:

98

answers:

2

Let me preface this (Because I know I'll get this eventually in the responses)

  • Yes I know about WCF, but we are not using that or plan to right now (boss won't budge)

Ok, so my questions are the following. First I want to move some of our .asmx into a separate project. Right now it's in several scattered folders in our WAP project. Ok so if I create a new project:

1) What type should it be? 2) What deployment issues do I now have to face? Someone told me that if we move it to a separate project, we have to deploy it separately, I assume that means IIS, and yes, copying up that project to another place on the server 3) I was told that if we move it out of the WAP project we can no longer have that service run under our domain (something.com). But then someone told me you can setup a single web service to be a "pass-through" and have the actual .asmx files wherever you want? I don't get that.

The main concern is moving it. How to expose the services in that web project as we'll have multiple. How to deploy (both the files and IIS) it and then how to make sure it's still available under our same domain in production.

+3  A: 

The asmx file is simply a pointer to the C# code file. You can include the asmx files anywhere in your web project.

You can create a Web Service project in Visual Studio IDE, or simply create a Class Library and add the necessary references.

A web service project uses the following DLLs:

  • System.EnterpriseServices
  • System.Web
  • System.Web.Extensions
  • System.Web.Mobile
  • System.Web.Services

And the following web.config reference:

<configSections>
  <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
      <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
      </sectionGroup>
    </sectionGroup>
  </sectionGroup>
</configSections>  


<httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpHandlers>
bryanbcook
so if I create a class library, are you talking about just adding the references to other projects your codde relies on or ....what kind of references to what exactly?
CoffeeAddict
I'm talking about physically moving the .asmx files to a separate project themselves.
CoffeeAddict
+1  A: 

Agreed, create a new Web Service Project.

There's no issue having your webservice be deployed alongside your existing site in IIS.

Create your existing site url www.something.com then within IIS add a virtual directory or application to myservice so that you get www.something.com/myservice/awesome.asmx.

You could also create yourself an alternate host header to direct webservices.something.com to your webservices.

TreeUK