No listening wcf / rest endpoint

So my previous question revolved around turning wcf into a quiet service convert a WCF service to a RESTful application? which I was able to do with some help!

But I am having a problem with my client:

There were no listening endpoints at http: // localhost: 26535 / Service1.svc that could accept the message.
This is often caused by an invalid address or SOAP action. See InnerException, if present, for more details.

The soothing service is now working as seen from the screen dump:

enter image description here

And I can add value 1 from url like so:

enter image description here

But still I cannot run it on another new visual studio instance, my app.config client looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="WebHttpBinding_IService1">
                    <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                        messageVersion="Soap12" writeEncoding="utf-8">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    </textMessageEncoding>
                  <httpTransport></httpTransport>
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:26535/Service1.svc" binding="customBinding" bindingConfiguration="WebHttpBinding_IService1"
                contract="ServiceReference1.IService1" name="WebHttpBinding_IService1" />
        </client>
    </system.serviceModel>
</configuration>

      

Client code:

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        public ServiceReference1.Service1Client testClient = new ServiceReference1.Service1Client();
        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = testClient.GetData(Convert.ToInt32(textBox1.Text));
        }
    }
}

      

I have looked at previous issues in this area on SO here: WCF - "There were no endpoints listening ..." error

But he doesn't provide a solution? I am not familiar with hosting in IIS, or what it is not, just practice, so working on the debug (F5) will be zer goood!

+3


source to share


1 answer


This could be due to a change in the REST service.

Try to remove / comment this out from your host config

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

      

REST doesn't seem to pass any metadata (thus removing mex)



If you then reset your service reference, it should work correctly ... I believe.

Also, this article may be helpful

If you can use a third party I would suggest using RestSharp . It's extremely handy for using RESTful services :)

Or can you use the new WebAPI that can also make these calls more direct? The problem is that RESTful services are not as easily consumed as SOAP calls are / were

+2


source







All Articles