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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:23:53+00:00 2026-06-18T12:23:53+00:00

I am writing a below code to create a MM component in tridion through

  • 0

I am writing a below code to create a MM component in tridion through core service, but i am getting error to run this service,

 public ComponentData GetNewMultimediaComponent(CoreServiceClient Client, string folderUri, string schemaUri, string title, FileInfo fi)
    {
        if (fi.Extension == ".png")
        {
            string mmType = GetMultiMediaType(fi.Extension);
            if (mmType != null)
            {
                string tempLocation = "";

                UploadResponse us = new UploadResponse();
                using (StreamUploadClient streamClient = GetConnection())
                {
                    FileStream objfilestream = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read);
                    tempLocation = streamClient.UploadBinaryContent(fi.Name.ToLower(), objfilestream);
                }

                BinaryContentData bcd = new BinaryContentData
                {
                    UploadFromFile = fi.FullName,
                    MultimediaType = new LinkToMultimediaTypeData { IdRef = mmType },
                    Filename = fi.Name,
                    IsExternal = false
                };

                ComponentData res = GetNewComponent(folderUri, schemaUri, title);
                res.ComponentType = ComponentType.Multimedia;
                res.BinaryContent = bcd;

                res = (ComponentData)Client.Create(res, new ReadOptions());

In the above code i am getting the error on below line

using (StreamUploadClient streamClient = new StreamUploadClient()) 



{System.InvalidOperationException: Could not find default endpoint element that references contract 'Tridion.ContentManager.CoreService.Client.IStreamUpload' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
       at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
       at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
       at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
       at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
       at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
       at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
       at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait).......

Just for update, I am using tridion core services by DLL without config file and create connection successfully.

Connection setting

public StreamUploadClient GetConnection()
    {
        BasicHttpBinding basicHttpBinding = new BasicHttpBinding
        {
            MaxReceivedMessageSize = 10485760,
            ReaderQuotas = new XmlDictionaryReaderQuotas
            {
                MaxStringContentLength = 10485760,
                MaxArrayLength = 10485760
            },
            Security = new BasicHttpSecurity
            {
                Mode = BasicHttpSecurityMode.None,
            }
        };

        EndpointAddress remoteAddress = new EndpointAddress("http://abc/webservices/CoreService2011.svc/streamUpload_basicHttp");

        StreamUploadClient client = new StreamUploadClient(basicHttpBinding, remoteAddress);
        try
        {
            client.Open();
        }
        catch (Exception ex)
        {
           //log.Error("Error:CoreServiceConectionOpen:Common:" + ex.Message);
            throw ex;
        }

        return client;
    }

Now, getting error on below line

tempLocation = streamClient.UploadBinaryContent(fi.Name.ToLower(), objfilestream);

{System.ServiceModel.ProtocolException: The content type multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:739a821f-aee2-4eaf-9206-05a1ed19311c+id=1";start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 560 bytes of the response were: '
--uuid:739a821f-aee2-4eaf-9206-05a1ed19311c+id=1
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:FilePath xmlns:h="http://www.sdltridion.com/ContentManager/CoreService/2011">C:\Windows\TEMP\tmp6841.png</h:FilePath></s:Header><s:Body><UploadResponse xmlns="http://www.sdltridion.com/ContentManager/CoreService/2011"/></s:Body></s:Envelope>
--uuid:739a821f-aee2-4eaf-9206-05a1ed19311c+id=1--
'.

Can any one help me to resolve this issue?

  • 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-18T12:23:54+00:00Added an answer on June 18, 2026 at 12:23 pm

    The problem is in this line:

    StreamUploadClient streamClient = new StreamUploadClient()
    

    This is a separate endpoint you are trying to connect to. Typically it would pick adress and all other properties of a connection from app.config, but as you don’t have any you need to provide all the required parameters yourself, similar to what you do with your CoreService. Refer to app.config sample to see what paremeters you need.

    Something like this:

        public StreamUploadClient GetConnection()
        {
            BasicHttpBinding basicHttpBinding = new BasicHttpBinding
            {
                MaxReceivedMessageSize = 10485760,
                ReaderQuotas = new XmlDictionaryReaderQuotas
                {
                    MaxStringContentLength = 10485760,
                    MaxArrayLength = 10485760
                },
                MessageEncoding = WSMessageEncoding.Mtom,
                Security = new BasicHttpSecurity
                {
                    Mode = BasicHttpSecurityMode.None,
                }
            };
    
            EndpointAddress remoteAddress = new EndpointAddress("http://abc/webservices/CoreService2011.svc/streamUpload_basicHttp");
    
            StreamUploadClient client = new StreamUploadClient (basicHttpBinding, remoteAddress);
            try
            {
                client.Open();
            }
            catch (Exception ex)
            {
                log.Error("Error:CoreServiceConectionOpen:Common:" + ex.Message);
                throw ex;
            }
    
            return client;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing csv file from Datatable. Check my code below public static void
I am getting a syntax error for the code below. I am trying to
I am writing code to programmatically create a view. In this view I am
When writing the below my code locks up on GetResponse. Why? try { WebRequest
I constantly find myself writing similar code like the example below: if (object[Object Name]
I am writing a very simple HTML code which is listed below. Written in
I'm trying to run the code below to insert a whole lot of records
I'm writing code this week to dynamically change the color of images. As long
I am writing some code to create a Bitmap, do some drawing and then
I now have this code based on some of the answers below. Is this

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.