vb.net - Unable to resolve WCF "Metadata publishing for this service is currently disabled" error -
i'm branching out .net web services , unfortunately newbie @ it. i've decided build wcf service instead of asp.net service because of online recommendations. ultimate goal learn ios , other mobile programming. i'm familiar vb.net , c# standard , web applications.
i'm receiving "metadata publishing service disabled" error when trying test url. i've research , tried implementing "fixes" issue, still come short. can please @ code , see i'm doing wrong?
webconfig file
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" strict="false" explicit="true" targetframework="4.0" /> <customerrors mode="off"/> </system.web> <connectionstrings> </connectionstrings> <system.servicemodel> <services> <services> <service name="cct_main_srv.service1" behaviorconfiguration="behconfig"> <endpoint address="" binding="webhttpbinding" contract="cct_main_srv.service1" behaviorconfiguration="web"> </endpoint> <endpoint contract="imetadataexchange" binding="mexhttpbinding" address="mex" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="behconfig"> <servicemetadata httpgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="web"> <webhttp/> </behavior> </endpointbehaviors> </behaviors> <servicehostingenvironment multiplesitebindingsenabled="true"> </servicehostingenvironment> </system.servicemodel> <system.webserver> <modules runallmanagedmodulesforallrequests="true"/> <directorybrowse enabled="true"/> </system.webserver> </configuration>
.vb file
imports system.servicemodel imports system namespace cct_main_srv.service1 <servicecontract()> public interface cct_main_srv <operationcontract()> <webget(uritemplate:="get_device_authenication", _ requestformat:=webmessageformat.json, _ responseformat:=webmessageformat.json, _ bodystyle:=webmessagebodystyle.wrapped)> function authenicate_device_manager(byval device_name string, _ byval auth_key string) _ list(of device_authenication) <webget()> <operationcontract()> function authenicate_device_manager_non_json(byval device_name string, _ byval auth_key string) _ list(of device_authenication) end interface <datacontract()> public class device_authenication <datamember()> public property device_name string <datamember()> public property active boolean <datamember()> public property return_string string end class
svc.vb file
imports system.servicemodel imports system.web.script.serialization imports system.servicemodel.activation imports system.servicemodel.web imports system.servicemodel.description namespace cct_main_srv.service1 public class service1 implements cct_main_srv dim host webservicehost = new webservicehost(gettype(service1), new uri("http://pmh-vmutility-1/cct_web_srv_test/:8000/")) dim ep serviceendpoint = host.addserviceendpoint(gettype(cct_main_srv), new webhttpbinding(), "") public function authenicate_device_manager(byval device_name string, _ byval auth_key string) _ list(of device_authenication) _ implements cct_main_srv.authenicate_device_manager end function end class end namespace
service name="cct_main_srv.service1"
should be:
service name="service1"
or if resides in web application:
service name="projectname.web.service1"
it should match qualified name of service
{namespace}.{class}
yours not have namespace.
Comments
Post a Comment