Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8518321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:56:53+00:00 2026-06-11T05:56:53+00:00

I have a WCF webservice to receive files but when i make a post

  • 0

I have a WCF webservice to receive files but when i make a post call always return me Unsuported media type multipart-form-data when i try to send a file, if i dont send file and set contentype to xml, service get me an OK and create the file pruebffa.jpg fine
this is my web.config:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="streamBinding" transferMode="Streamed" messageEncoding="Mtom" maxReceivedMessageSize="615424521" openTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00"/>
        </basicHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    <services>
        <service name="WcfService3.Service1" behaviorConfiguration="WcfService3.Service1Behavior">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="streamBinding" contract="WcfService3.IService1">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="WcfService3.Service1Behavior">
                <!-- 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>
</system.serviceModel>

code:

[ServiceContract]
public interface IService1
{
    [OperationContract]
    [WebGet(BodyStyle=WebMessageBodyStyle.Bare, UriTemplate="")] 
    void UploadImage(Stream image);
}

public class Service1 : IService1
{
    public void UploadImage(Stream image)
    {
        var buf = new byte[1024];
        var path = Path.Combine(@"C:\", "pruebffa.jpg");
        int len = 0;
        using (var fs = File.Create(path))
        {
            while ((len = image.Read(buf, 0, buf.Length)) > 0)
            {
                fs.Write(buf, 0, len);
            }
        }
    }
}

How can i enabled to accept multipart/form-data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:56:54+00:00Added an answer on June 11, 2026 at 5:56 am

    Since it’s a POST operation you should use WebInvoke instead of WebGet.

    [OperationContract]     
    [WebInvoke(..)]      
    void UploadImage(Stream image); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have wcf service hosed in sharepoint application. But when i try to call
I have developed a WCF WebService. On client side they are unable to send
I have a mobile app webservice client that connects to a WCF webservice(on my
Im working on a Web-Application (MyWebApp). I have a Service-Reference to a WCF-Webservice. The
I have C# Client application calling Windows webservice written in WCF calling Sql Procedure
I would like to add uploading files to my WCF REST web service, but
I created a WCF Webservice method that receives two parameters, string, and return an
I have a RESTful WCF web service that processes huge XML files that are
I have a WCF service that can receive several requests/minute (or seconds) that need
I have a WCF Ajax enabled web service that I call via jquery. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.