How to host my WCF Service on IIS -
i want host service on iis , let people local network use it. here interface:
namespace subscriptionservice { [servicecontract] public interface isubsservice { // soa [operationcontract] [webget(uritemplate = "registerevent/{serviceid}/{name}/{description}")] string registerevent(string serviceid, string name, string description); [operationcontract] [webget(uritemplate = "unregisterevent/{serviceid}/{name}")] string unregisterevent(string serviceid, string name); [operationcontract] [webget(uritemplate = "riseevent/{serviceid}/{name}")] string riseevent(string serviceid, string name); // rest [operationcontract] [webget(uritemplate = "events/{token}", responseformat = webmessageformat.json)] list<eventinfo> eventslist(string token); [operationcontract] [webget(uritemplate = "subscribe/{token}/{serviceid}/{name}")] string subscribe(string token, string serviceid, string name); [operationcontract] [webget(uritemplate = "unsubscribe/{token}/{serviceid}/{name}")] string unsubscribe(string token, string serviceid, string name); } } and web.config:
<?xml version="1.0"?> <configuration> <appsettings> <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" /> </appsettings> <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework="4.5"/> </system.web> <system.servicemodel> <services> <service name="subscriptionservice.subsservice"> <endpoint address="soap" binding="basichttpbinding" contract="subscriptionservice.isubsservice"></endpoint> <endpoint address="rest" binding="webhttpbinding" contract="subscriptionservice.isubsservice" behaviorconfiguration="web"></endpoint> </service> </services> <behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true" httpsgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="false"/> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="web"> <webhttp/> </behavior> </endpointbehaviors> </behaviors> <protocolmapping> <add binding="basichttpsbinding" scheme="https" /> </protocolmapping> <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" /> </system.servicemodel> <system.webserver> <modules runallmanagedmodulesforallrequests="true"/> <directorybrowse enabled="true"/> </system.webserver> </configuration> i need use both soa , rest methods. there wrong config? tried add service on iis, didn't work. set sitename "my service", path directory svc file, host name "myservice" , port. , didn't work. not able access on local machine.
Comments
Post a Comment