Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 23, 2013 05:31 AM by Haixia Xie - MSFT
Jan 21, 2013 02:54 PM|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 04:16 PM|LINK
i would created 1 asmx, then create the function that call the distinct functions in your classes.
Jan 21, 2013 08:46 PM|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 05:31 AM|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" />