I want create dynamic WCF service channel in VS-2010 using ChannelFactory as follows.
I have one WCF service which is calling another WCF service using ChannelFactory as follows,
BasicHttpBinding myBinding = new BasicHttpBinding();
EndpointAddress myEndpoint = new EndpointAddress(_endpointConfigurationName);
using (ChannelFactory<IService> factory = new ChannelFactory< IService >(myBinding))
{
factory.Open();
object[] parameters = new object[1];
parameters[0] = _documentId;
IService proxy = factory.CreateChannel(myEndpoint);
if (proxy == null)
return;
MethodInfo mi = proxy.GetType().GetMethod("DoExecute");
if (mi == null)
return;
var serviceResult = mi.Invoke(proxy, parameters);
factory.Close();
}
“Web.config” file of called service as follows,
<services>
<service name="IService.Service">
<endpoint address="ws" binding="wsHttpBinding" name="wsHttpBinding_IFTPUploaderService" contract="Service.IService ">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8752/Service/" />
</baseAddresses>
</host>
</service>
</services>
factory and proxy is working fine but when “Invoke” method is executed it gives error as follows
There was no endpoint listening at http://localhost:81/IService.Service.svc?wsdl that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at SchedulerService.Service.IService.DoExecute(String id)
[Edit - CHill60]
OP has already tried this solution
Error: There was no endpoint listening at...[
^]. I have deleted my solution