c# - An exception was thrown in a call to a WSDL export extension - WCF -
i trying connect webservice windows form application, when try open link webservice browser error message:
an exceptiondetail, created includeexceptiondetailinfaults=true, value is: system.invalidoperationexception: exception thrown in call wsdl export extension: system.servicemodel.description.datacontractserializeroperationbehavior contract: http://tempuri.org/:imobilews ----> system.invalidoperationexception: request in operation uploadfile stream operation must have single parameter type stream. @ system.servicemodel.dispatcher.streamformatter.validateandgetstreampart(messagedescription messagedescription, boolean isrequest, string operationname) @ system.servicemodel.dispatcher.streamformatter.create(messagedescription messagedescription, string operationname, boolean isrequest) @ system.servicemodel.description.messagecontractexporter.exportmessage(int32 messageindex, object state) @ system.servicemodel.description.messagecontractexporter.exportmessagecontract() @ system.servicemodel.description.wsdlexporter.callextension(wsdlcontractconversioncontext contractcontext, iwsdlexportextension extension) --- end of inner exceptiondetail stack trace --- @ system.servicemodel.description.servicemetadatabehavior.metadataextensioninitializer.generatemetadata() @ system.servicemodel.description.servicemetadataextension.ensureinitialized() @ system.servicemodel.description.servicemetadataextension.httpgetimpl.initializationdata.initializefrom(servicemetadataextension extension) @ system.servicemodel.description.servicemetadataextension.httpgetimpl.getinitdata() @ system.servicemodel.description.servicemetadataextension.httpgetimpl.tryhandledocumentationrequest(message httpgetrequest, string[] queries, message& replymessage) @ system.servicemodel.description.servicemetadataextension.httpgetimpl.processhttprequest(message httpgetrequest) @ syncinvokeget(object , object[] , object[] ) @ system.servicemodel.dispatcher.syncmethodinvoker.invoke(object instance, object[] inputs, object[]& outputs) @ system.servicemodel.dispatcher.dispatchoperationruntime.invokebegin(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage5(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage11(messagerpc& rpc) @ system.servicemodel.dispatcher.messagerpc.process(boolean isoperationcontextset)
in third line noticed in uploadingfile function:
system.invalidoperationexception: request in operation uploadfile stream operation must have single parameter type stream
this uploadfile function:
// in interface [operationcontract] [webinvoke(method = "post", uritemplate = "/uploadfile/{senderid}/{filename}" , responseformat = webmessageformat.json)] string uploadfile(string senderid, string filename ,stream image); // implementation public string uploadfile(string senderid, string filename, stream image) { // ..... unwrapping stream , saving file }
this function works uploading images without problems. why message appearing?
note: tried ansowers in this question, did not work
this web config file:
<?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <appsettings> <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" /> </appsettings> <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime /> <pages controlrenderingcompatibilityversion="4.0" /> </system.web> <system.servicemodel> <services> <service name="myportal.mobilews" behaviorconfiguration="servicebehavior"> <endpoint binding="webhttpbinding" contract="myportal.imobilews" behaviorconfiguration="webhttp" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="servicebehavior"> <servicemetadata httpgetenabled="true" httpsgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="webhttp"> <webhttp /> </behavior> </endpointbehaviors> </behaviors> <standardendpoints> <webhttpendpoint> <standardendpoint name="" helpenabled="true" automaticformatselectionenabled="false" defaultoutgoingresponseformat="json" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647" maxbufferpoolsize="4194304" transfermode="buffered" /> </webhttpendpoint> </standardendpoints> <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" /> <bindings> <webhttpbinding> <binding maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647" transfermode="streamed"> </binding> </webhttpbinding> </bindings> </system.servicemodel> <system.webserver> <modules runallmanagedmodulesforallrequests="true" /> <directorybrowse enabled="true" /> </system.webserver> <connectionstrings> .... </connectionstrings> <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" /> <providers> <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver" /> </providers> </entityframework> </configuration>
Comments
Post a Comment