.net - Unable to start Windows Service that hosts WCF service with NetNamedPipeBinding binding -



.net - Unable to start Windows Service that hosts WCF service with NetNamedPipeBinding binding -

i creating windows service supposed host wcf service netnamedpipebinding binding. next code:

protected override void onstart(string[] args) { var servicetype = typeof(iservehi); var namedpipebinding = new netnamedpipebinding(); namedpipebinding.security.mode = netnamedpipesecuritymode.none; var namedpipeendpoint = ""; var basenamedpipeuri = new uri("net.pipe://myworkstation:51301/"); // line # 41 host = new servicehost(typeof(servehi), basenamedpipeuri); host.addserviceendpoint(servicetype, namedpipebinding, namedpipeendpoint); host.description.behaviors.add(new servicemetadatabehavior { httpgetenabled = true}); host.open(); }

the installutil.exe able install it. however, when seek start service, message the windowsservicehost1 on local computer started , stopped. services stop automatically if not in utilize other services or programs.

further, windows log reads as:

service cannot started. system.uriformatexception: invalid uri: hostname not parsed. @ system.uri.createthis(string uri, boolean dontescape, urikind urikind) @ system.uri..ctor(string uristring) @ windowsservicehost1.windowsservicehost1.onstart(string[] args) in c:\windowsservicehost1\service1.cs:line 41 @ system.serviceprocess.servicebase.servicequeuedmaincallback(object state)

i have tried wshttpbinding & nettcpbinding , work fine.

you'll want remove port number net.pipe uri. seek changing line 41 to:

var basenamedpipeuri = new uri("net.pipe://myworkstation/");

or if need more descriptive pipe name:

var basenamedpipeuri = new uri("net.pipe://myworkstation_51301/");

this blog post has helpful insight on issue.

.net wcf windows-services netnamedpipebinding

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -