c# - WCF Works As Svc Host But Not As Windows Service -
i have wcf service works correctly when hosted in wcfsvchost; when host windows service following error:
an unhandled exception of type 'system.invalidoperationexception' occurred in system.servicemodel.dll. additional information: httpgetenabled property of servicemetadatabehavior set true , httpgeturl property relative address, there no http base address. either supply http base address or set httpgeturl absolute address.
below config:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.5" /> </startup> <system.servicemodel> <services> <service name="filebetservice.service"> <endpoint address="" binding="basichttpbinding" bindingconfiguration="largemessagebinding" contract="filebetservice.iservice"/> <host> <baseaddresses> <add baseaddress="http://localhost:8000/fb/"/> </baseaddresses> </host> </service> </services> <behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="false"/> </behavior> </servicebehaviors> </behaviors> <bindings> <basichttpbinding> <binding name="largemessagebinding" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" closetimeout="00:15:00" opentimeout="00:15:00" receivetimeout="00:15:00" sendtimeout="00:15:00"> <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647"/> </binding> </basichttpbinding> </bindings> </system.servicemodel> </configuration>
i have made suggested changes app config error no longer occuring metadata (wsdl) not being displayed
<system.servicemodel> <services> <service name="filebetservice.service"> <host> <baseaddresses> <add baseaddress="http://localhost:8000/iservice/"/> </baseaddresses> </host> <endpoint address="mex" binding="mexhttpbinding" contrac="imetadataexchange"></endpoint> <endpoint address="http://localhost:8000/fbturf12/" binding="basichttpbinding" bindingconfiguration="largemessagebinding" contract="filebetservice.iservice"/> </service> </services> <behaviors> <servicebehaviors> <behavior name="default"> <servicemetadata httpgetenabled="true" httpgeturl="http://localhost:8000/iservice/mex"/> <servicedebug includeexceptiondetailinfaults="false"/> </behavior> </servicebehaviors> </behaviors> <bindings> <basichttpbinding> <binding name="largemessagebinding" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" closetimeout="00:15:00" opentimeout="00:15:00" receivetimeout="00:15:00" sendtimeout="00:15:00"> <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647"/> </binding> </basichttpbinding> </bindings> </system.servicemodel>
Comments
Post a Comment