c# - WebInvoke POST stops service from installing -


i'm totally new @ c#. sorry

i'm trying create wcf rest service , put files on web server. following operation works great:

         [operationcontract]     [webinvoke(method = "get", bodystyle = webmessagebodystyle.bare, uritemplate = "getmediafile?shopnumber={shopnumber}&filename={filename}")]     stream getmediafile(string shopnumber, string filename); 

everything works expected until add following operation

 [operationcontract]     [webinvoke(method = "post", bodystyle = webmessagebodystyle.bare, responseformat =        webmessageformat.json, uritemplate = "putmediafile?shopnumber={shopnumber}&filename={filename}")]     string putmediafile(string shopnumber, string filename, stream mediafile); 

i'm installing service clicking on green arrow launches tool installs service. need test ios device.

the problem once add post method, following error during service install:

 "failed add service. service metadata may not accessible. make sure service running , exposing metadata" 

followed more indepth explanation:

 "error: cannot obtain metadata http://localhost/mpiphotostore/photostoreservice.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/mpiphotostore/photostoreservice.svc    metadata contains reference cannot resolved: 'http://localhost/mpiphotostore/photostoreservice.svc'.    there no endpoint listening @ http://localhost/mpiphotostore/photostoreservice.svc accept message. caused incorrect address or soap action. see innerexception, if present, more details.    remote server returned error: (404) not found.http error    uri: http://localhost/mpiphotostore/photostoreservice.svc    there error downloading 'http://localhost/mpiphotostore/photostoreservice.svc'.    request failed error message:--<html><head><style type="text/css">#content{ font-size: 0.7em; padding-bottom: 2em; margin-left: 30px}body{margin-top: 0px; margin-left: 0px; color: #000000; font-family: verdana; background-color: white}p{margin-top: 0px; margin-bottom: 12px; color: #000000; font-family: verdana}pre{border-right: #f0f0e0 1px solid; padding-right: 5px; border-top: #f0f0e0 1px solid; margin-top: -5px; padding-left: 5px; font-size: 1.2em; padding-bottom: 5px; border-left: #f0f0e0 1px solid; padding-top: 5px; border-bottom: #f0f0e0 1px solid; font-family: courier new; background-color: #e5e5cc}.heading1{margin-top: 0px; padding-left: 15px; font-weight: normal; font-size: 26px; margin-bottom: 0px; padding-bottom: 3px; margin-left: -30px; width: 100%; color: #ffffff; padding-top: 10px; font-family: tahoma; background-color: #003366}.intro{margin-left: -15px}</style><title>service</title></head><body><div id="content"><p class="heading1">service</p><br/><p class="intro">the server unable process request due internal error.  more information error, either turn on includeexceptiondetailinfaults (either servicebehaviorattribute or <servicedebug> configuration behavior) on server in order send exception information client, or turn on tracing per microsoft .net framework sdk documentation , inspect server trace logs.</p></div></body></html>--." 

like said, have 2 operation , 1 delete operation work fine.

here web.config

 <?xml version="1.0"?>  <configuration>   <appsettings>  <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" />  <add key="rootfilepath" value="\\ommacdev02vm1\images"/>  </appsettings>  <system.web>   <compilation debug="true" targetframework="4.0" />   </system.web>  <system.servicemodel>  <protocolmapping>   <add scheme="http" binding="webhttpbinding"/>  </protocolmapping>  <behaviors>   <servicebehaviors>     <behavior>       <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment -->       <servicemetadata httpgetenabled="true"/>       <!-- receive exception details in faults debugging purposes, set value below true.  set false before deployment avoid disclosing exception information -->       <servicedebug includeexceptiondetailinfaults="false"/>      </behavior>   </servicebehaviors>   <endpointbehaviors>     <behavior>       <webhttp/>     </behavior>   </endpointbehaviors> </behaviors> <servicehostingenvironment multiplesitebindingsenabled="true" /> 

i've read mex endpoints i'm looking @ json right now. web.config working fine every other method.

help!!!!!!!!!!!!!!

the problem in web.config file:

 <?xml version="1.0"?>  <configuration> <appsettings>  <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" /> <add key="rootfilepath" value="\\ommacdev02vm1\images"/> </appsettings> <system.web>     <compilation debug="true" targetframework="4.0" /> </system.web> <system.servicemodel> <bindings>   <webhttpbinding>     <binding maxreceivedmessagesize="10485760" />   </webhttpbinding> </bindings> <services>   <service name="mpiphotostore.photostore" behaviorconfiguration="servicebehaviour">     <endpoint address ="" binding="webhttpbinding" contract="mpiphotostore.iphotostoreservice" behaviorconfiguration="web">     </endpoint>     </service>   </services> <behaviors>   <servicebehaviors>     <behavior name="servicebehaviour">       <servicemetadata httpgetenabled="true"/>       <servicedebug includeexceptiondetailinfaults="true"/>     </behavior>   </servicebehaviors>   <endpointbehaviors>     <behavior name="web">       <webhttp/>     </behavior>   </endpointbehaviors> </behaviors> </system.servicemodel>  </configuration> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -