Hi ALL,
I am getting the following error and I am not sure what I am doing wrong. Does anybody see anything obvious? Below are my project's Web.config and my reference link in code behind.
My error is:
The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified.
My web.config:
<system.serviceModel>
<services>
<service behaviorConfiguration="WcfService3._5.Service1Behavior"
name="WcfService3._5.Service1">
<endpoint address="" binding="basicHttpBinding" contract="WcfService3._5.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="WcfService3._5.LoginBehavior"
name="WcfService3._5.Login">
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" contract="WcfService3._5.ILogin">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:63460/Login"/>
</baseAddresses>
</host>
</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>
My code behind is :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string res;
string strXmlRequest = string.Empty;
strXmlRequest = "<root><loginapi><username>wsadmin<password>pass<sessionid>b5uwdafp4u5wkxmq0ksmqa55";
// convert string to stream
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(strXmlRequest);
MemoryStream stream = new MemoryStream(byteArray);
api5.LoginClient ap = new api5.LoginClient();
res = ap.POSTLogin(stream);
}
}
Please drop me a solution for this.
thanks in advance.
What I have tried:
The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified