Error : There was no endpoint listening at http://localhost:63460/Login.svc that could accept the message in WCF Services

stellusmca
 
on Feb 01, 2017 02:34 AM
12723 Views
Hi ALL,
I am working with wcf service
in that i am little confusing about Endpoint in web.config file

the moment is i have one application
that application i am testing two ways,
1. using RestClient from browser 
2. WCF service i configure to App_WebReferences from code behind

My Problem is,

when i add below line in web.config of wcf service
then my first type is working fine but second type is not working

<endpoint address=""  behaviorConfiguration="web" binding="webHttpBinding" contract="WcfService3._5.ILogin">
second type error is :

There was no endpoint listening at http://localhost:63460/Login.svc that could accept the message.
This is often caused by an incorrect address or SOAP action.

but when i add below line in web.config of wcf service
then my second type is working fine but first type is not working
<endpoint address=""  binding="basicHttpBinding" contract="WcfService3._5.ILogin">
BUT i need to work both the type at same time.
May be i miss some configuration setting in web.config file but i dont know which configuration

My web.config service is :


<system.serviceModel>
    <services>
      
      <service behaviorConfiguration="WcfService3._5.LoginBehavior"
        name="WcfService3._5.Login">
        
        <endpoint address="http://localhost:63460/Login.svc"  binding="basicHttpBinding" contract="WcfService3._5.ILogin">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
       
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp />
         
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="WcfService3._5.Service1Behavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
        <behavior name="WcfService3._5.LoginBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

WCF service i configure to App_WebReferences from code behind :

 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.ServiceModel;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

try
{
string res;

string strXmlRequest = string.Empty;
string strXmlRequest1 = string.Empty;
strXmlRequest1 = "<whisinattandenceleave><month>2017-01-01<clientid>877977950915<methodname>proGenericWhoisinAPI";
// convert string to stream
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(strXmlRequest1);

MemoryStream stream = new MemoryStream(byteArray);

API.LoginClient ap =new API.LoginClient();

res = ap.POSTLogin(stream);

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
}


}

so please drop me a solution for this. thanks in advance.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
stellusmca
 
on Feb 01, 2017 11:22 PM

THANKS FOR YOUR SUPPORT,

FINALLY I FOUND THE SOLUTION WITH THE BELOW CODE,

<endpoint address="soap" binding="basicHttpBinding" contract="WcfService3._5.ILogin">
</endpoint>
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" contract="WcfService3._5.ILogin">