I get no endpoint listening error when trying to connect to a WCF service with named pipe endpoint from web site hosted in IIS.
There was no endpoint listening at net.pipe://{machinename}/{ServiceName} that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
I'll explain the setup. The WCF service is hosted in a background process spawned from a WinForms application. This is for the testing purpose and the background process will be launched by Windows Service in production. The Web site connects to the WCF service running in the same machine through the pipe endpoint. The Web application is ASP MVC Core hosted in IIS on Windows 10.
The Web application connects to the service when running in IIS Express from Visual studio (VS2015) but fails when hosted in IIS. This looked like some permission issue with the web site so I tried running the web application under user with Administrator privileges and application pool identity but had no luck in getting it work.
The WCF service hosting code is
_serviceHost = new ServiceHost(typeof(Serviceprovider));
_serviceHost.AddServiceEndpoint(
typeof(IServiceprovider),
new NetNamedPipeBinding
{
ReceiveTimeout = TimeSpan.MaxValue,
},
"net.pipe://" + System.Environment.MachineName + "/Serviceprovider");
_serviceHost.Faulted += new EventHandler(ServiceHostFaulted);
_serviceHost.Open();
Program.cs (Web project)
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
Has anyone faced this issue before or got any suggestions?