c# - WCF Service runs perfectly when running under iis express but same service wont work when running under Local IIS with its virtual directory -


i practising wcf , stuck situation. wcf service works under iisexpress (default vs2013). when use same under local iis, got below exception in wcf test client.

error: cannot obtain metadata http://localhost/wcfservice1/service1.svc if windows (r) communication foundation service have access, please check have enabled metadata publishing @ specified address. enabling metadata publishing, please refer msdn documentation @ http://go.microsoft.com/fwlink/?linkid=65455.ws-metadata exchange error uri: http://localhost/wcfservice1/service1.svc metadata contains reference cannot resolved: 'http://localhost/wcfservice1/service1.svc'. remote server returned unexpected response: (405) method not allowed. remote server returned error: (405) method not allowed.http error uri: http://localhost/wcfservice1/service1.svc there error downloading 'http://localhost/wcfservice1/service1.svc'. request failed http status 404: not found.

my web config has endpoint metadata exchange , behaviour has httpgetenabled true.

see web.config:

<?xml version="1.0"?> <configuration>    <system.diagnostics>     <sources>       <source name="system.servicemodel.messagelogging" switchvalue="warning,activitytracing">         <listeners>           <add type="system.diagnostics.defaulttracelistener" name="default">             <filter type="" />           </add>           <add name="servicemodelmessagelogginglistener">             <filter type="" />           </add>         </listeners>       </source>     </sources>     <sharedlisteners>       <add initializedata="f:\tfs\wcfservice1\wcfservice1\web_messages.svclog"         type="system.diagnostics.xmlwritertracelistener, system, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089"         name="servicemodelmessagelogginglistener" traceoutputoptions="timestamp">         <filter type="" />       </add>     </sharedlisteners>     <trace autoflush="true" />   </system.diagnostics>   <appsettings>     <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" />   </appsettings>   <system.web>     <compilation debug="true" targetframework="4.5" />     <httpruntime targetframework="4.5"/>   </system.web>   <system.servicemodel>     <diagnostics>       <messagelogging logentiremessage="true" logmalformedmessages="true"         logmessagesattransportlevel="true" />     </diagnostics>     <services>       <service behaviorconfiguration="behave" name="wcfservice1.service1">         <endpoint address="wcfservice1.service1" binding="basichttpbinding" name="basichttp"           contract="wcfservice1.iservice1" />         <endpoint binding="mexhttpbinding" name="mex" contract="imetadataexchange" />         <host>           <baseaddresses>             <add baseaddress="http://localhost/wcfservice1/" />           </baseaddresses>         </host>       </service>     </services>     <behaviors>       <servicebehaviors>         <behavior name="behave">           <servicemetadata httpgetenabled="true" policyversion="policy15" />           <servicedebug includeexceptiondetailinfaults="true"/>         </behavior>       </servicebehaviors>     </behaviors>     <protocolmapping>         <add binding="basichttpsbinding" scheme="https" />     </protocolmapping>         <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />   </system.servicemodel>   <system.webserver>     <modules runallmanagedmodulesforallrequests="true"/>     <!--         browse web app root directory during debugging, set value below true.         set false before deployment avoid disclosing web app folder information.       -->     <directorybrowse enabled="true"/>   </system.webserver>  </configuration> 

i checked other wcf questions. couldn't find answer. in advance.

when use local iis, able hit url http://localhost/wcfservice1/ , shows me files @ directory. when click on service1.svc, shows iis error page.

http error 404.3 - not found page requesting cannot served because of extension configuration. if page script, add handler. if file should downloaded, add mime map.

after addng wcf activation in iis. getting different error. couldn't understand it. enter image description here

you need enable wcf in iis manager site, see: https://blogs.msdn.microsoft.com/blambert/2009/02/13/how-to-enable-iis7asp-net-and-wcf-http-activation/

once wcf enabled iis should able run without problem.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -