Last post Jan 23, 2013 01:31 AM by Haixia Xie - MSFT
Jan 21, 2013 10:54 AM|RichardLaw|LINK
I'm very new to web services. After a little YouTube research, I've built and run my first basic web service.
What I'd like to understand is how best to structure it. For example: One ASMX file contains one class with multiple methods. I've worked out I need 8 or so classes (each with a number of methods), which means I need to create 8 ASMX files, and then references
all 8 to my website that uses them.
Is there not a way I can use only one ASMX file and create multiple classes - like I would in a cs file with namespacese? It just seems long winded to add a reference for every file I create.
Thanks as always
Jan 21, 2013 12:16 PM|UstesG|LINK
i would created 1 asmx, then create the function that call the distinct functions in your classes.
Jan 21, 2013 04:46 PM|RichardLaw|LINK
Hummmm. Is there any easy way to include 8 or so web services to a website without addeding references for all of them?
Jan 23, 2013 01:31 AM|Haixia Xie - MSFT|LINK
You can have single service with multiple contracts, but you need to have a class that implement all of the service contracts that you have exposed and configure the service like.
<service name="ServiceNameSpace.ServiceImplementationCLass" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="basicHttpBinding" contract="ServiceContract1" />
<endpoint address="" binding="basicHttpBinding" contract="ServiceContract2" />