Results 1 to 5 of 5

Thread: WCF Service upload file

  1. #1

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    WCF Service upload file

    Hi Guys,

    Im at a total loss with this one.
    every time i attempt it i think im worse off for the experience.

    Basically I have a service which is working fine in regards to getting data in and out of my database
    (consumed by windows form application)

    now i need a routine where the user(from the windows application) can upload files(images) to my server - where the service and website is hosted.

    Am i going about this the wrong way or is this the way to go for uploading files ?
    Any vb.net links or tutorials welcome.

    Thanks

    D
    it works 60% of the time, all the time.

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Re: WCF Service upload file

    this is the right way to go. You dont want external users having direct access to the database. By keeping it in a service, you can do some upfront validation in the client, file sizes, no malitious uploads etc.

  3. #3

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: WCF Service upload file

    Thanks bill,

    Do you know of any links or keywords i can look for as i need to see some examples ?
    anything ive tried to this point has failed (its been a while now since i tried this and im only coming back to it now)
    it works 60% of the time, all the time.

  4. #4

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: WCF Service upload file

    IM in a world of hurt with this...
    Any help at all is greatly appreciated


    Ive tried many different things ive seen on the web with this being the simplest i can see. Im thinking hes not giving me all of the information i need.
    other issues i had with other solutions were parser errors saying behaviour dont exist...
    http://scorpiotek.com/blog/?p=393

    anyway - as it stands at the moment ive reverted to this 'simpler' solution
    The appconfig of my client

    Code:
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                        useDefaultWebProxy="true">
                        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                        <security mode="None">
                            <transport clientCredentialType="None" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                        </security>
                    </binding>
                </basicHttpBinding>
    and the web config of my wcf is like so
    Code:
     <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="myBindingForBigArrays"
            maxReceivedMessageSize="2147483647">
              <readerQuotas
              maxDepth="64"
               maxStringContentLength="2147483647"
              maxArrayLength="2147483647"
              maxBytesPerRead="4096"
               maxNameTableCharCount="16384"/>
            </binding>
          </basicHttpBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="true"/>
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
    but my issue still remians
    its like the image / file im sending is too big

    ---------------------------

    ---------------------------
    System.ServiceModel.ProtocolException: The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'fileUpload'. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 25096.



    Server stack trace:

    at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)

    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)



    Exception rethrown at [0]:

    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

    at ....ServiceReference1.IService1.fileUpload(Byte[] f, String fileName)
    ---------------------------
    OK
    ---------------------------
    it works 60% of the time, all the time.

  5. #5

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: WCF Service upload file

    and now im getting a bad request response with all my messing.
    ive tried setting this in code and still it has no effect.
    the wcf is hosted online on iis.

    ive wiped the slate clean and created a new wcf service which has been uploade.
    im calling a single operation with the same response.
    anyone ....
    it works 60% of the time, all the time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width