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 6714015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:26:48+00:00 2026-05-26T08:26:48+00:00

I have a WCF rest service. I created it using 4.0 rest service application,

  • 0

I have a WCF rest service. I created it using 4.0 rest service application, so it is SVC-less.

I have this service contract:

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class Service1
{


    [WebGet(UriTemplate = "/Login/?username={username}&password={password}", ResponseFormat= WebMessageFormat.Json)]
    public Response Login(string username, string password)
    {

        Response res;
        BillboardsDataContext db = new BillboardsDataContext();
        var q = from lgin in db.logins
                where lgin.username == username && lgin.password == password
                select lgin;
        if (q.Count() != 0)
        {
            res = new Response(true, "Login successful");
            return res;
        }
        else
        {
            res = new Response(false, "Login failed!");
            return res;
        }


    }

    [WebInvoke(UriTemplate = "", Method = "POST")]
    public void Upload(Stream fileStream)
    {
        FileStream targetStream = null;
        string uploadFolder = @"C:\inetpub\wwwroot\Upload\test.jpg";
        using (targetStream = new FileStream(uploadFolder, FileMode.Create,
            FileAccess.Write, FileShare.None))
        {
            const int bufferLen = 65000;
            byte[] buffer = new byte[bufferLen];
            int count = 0;
            while ((count = fileStream.Read(buffer, 0, bufferLen)) > 0)
            {
                targetStream.Write(buffer, 0, count);
            }
            targetStream.Close();
            fileStream.Close();
        }
    }

}

and this web.config:

<services>
  <service name="BillboardServices.Service1" behaviorConfiguration="Meta">
    <endpoint name="restful" address="" binding="webHttpBinding" behaviorConfiguration="REST" contract="BillboardServices.Service1" />
    <endpoint name="streamFile" address="/Upload" binding="basicHttpBinding" bindingConfiguration="streamBinding" contract="BillboardServices.Service1" />
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="REST">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="Meta">
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceMetadata httpGetEnabled="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="streamBinding" maxReceivedMessageSize="64000" maxBufferSize="64000" transferMode="Streamed" messageEncoding="Mtom">
      <readerQuotas maxDepth="64000" maxStringContentLength="64000" maxArrayLength="64000" maxBytesPerRead="64000" maxNameTableCharCount="64000"/>
    </binding>
  </basicHttpBinding>
</bindings>

The login service works very well, but I am having an issue with the Upload action. I call it through an Android app via http://www.myhost.com/Upload and I get this error:

Content Type multipart/form-data; boundary=wjtUI0EFrpQhBPtGne9le5_-yMxPZ_sxZJUrFf- was sent to a service expecting multipart/related; type="application/xop+xml".  The client and service bindings may be mismatched.

I can’t find info on this error. Anybody seen this before?

Thank you!

  • 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-05-26T08:26:49+00:00Added an answer on May 26, 2026 at 8:26 am

    So it turns out that I needed to use webHttpBinding for both endpoints, not just the login.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a new wcf rest service using .net 4. I have created a
I have created a REST service using WCF for communicating with BLL/DAL from UI.
I have created a REST web service using WCF and use HTTP Post Method.
I have a WCF-REST service with one method which returns a string: [ServiceContract] public
I have created a MVC 3 WCF Rest project using the tutorial described here
I have a typical Silverlight application with a WCF service and I am using
I have created a WCF REST style service in my project. In development I
I have a serializable dictionary that I created for a WCF REST web service
I have a REStful WCF web service (using a substantially modified WCF Rest Starter
I have created a WCF REST Service and have successfully created a function to

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.