netsh http add urlacl fail - parameter is incorrect - wcf

I'm trying to register wcf net tcp port sharing, for a process to listen on this port (currently the client machine can't even ping this port eventhough the process is up so I read this command is needed):
netsh http add urlacl user=domain\svcUser url=net.tcp://+:8092/Service1
getting Url reservation failed, Error 87. The parameter is incorrect.
Also tried changing the user, the port, removing the Service1, adding a trailing /. Is there anything else that should be done?
Remark: The following command does succeed (but does not help): netsh http add urlacl user=domain\svcUser url=http://+:8092/Service1
This post shows the usage of netsh in this case
This post deals with error 87 but did not solve in my case

You mean the command succeed but it didn't work. This is not normal.
Maybe you can try this:
netsh http add urlacl url=http://+:8092 user=domain\svcUser

Related

Cannot unbind a certificate from a port (Windows 7)

On Friday I successfully bound my certificate to port 443 using netsh.
Today I need to change the port, so I tried to 'unbind' it with netsh:
netsh delete sslcert ipport=0.0.0.0:443
The result is an error message
The following command was not found: delete sslcert
ipport=0.0.0.0:443.
Confusingly the command is exactly as specified in the Microsoft documentation for netsh.
How do I remove a port binding so that I can rebind the certificate to another port?
Try this one
netsh http delete sslcert ipport=0.0.0.0:443
You were missing the http parameter.

Does netsh add sslcert with a http url still enable ssl?

When hosting a WCF service in a windows service, we can use netsh http add urlacl url=https://+:1234/xService user=DOMAIN\USER
Then to add SSL we could do:
netsh http add sslcert ipport=0.0.0.0:1234 certhash="xxxxx" appid="{xxxxx}".
In the example code here https://msdn.microsoft.com/en-us/library/ms733791(v=vs.110).aspx they seem to use a http address.
Does this make any difference? If you run netsh http add sslcert on a port reserved with a http:// address will it still be secured by the certificate, or does it have to be a https address?
It needs to use https and your service should also serve https://...

Enabling https with NancyFx Owin Self-host

I'm selfhosting a NancyFx service with Owin (on intranet from a Windows 8 machine) and it works fine. Trying to switch to HTTPS but have run into problems.
I have:
Created self-signed root CA
Created exchange-cert using above CA (CN=mycomputer)
Exported public key of CA and installed on client-machine
Used netsh to add urlacl to https://+:5001
Used netsh to add sslcert with thumb-hash etc.
The service-host looks to start allright on my address, https://mycomputer:5001, but when I try to access this address I first get the warning about unsecure connection (which I shouldn't if I have installed the public key CA-cert right?) and when continuing anyway I get a "service not available"-respons.
Any hints to what could be wrong?
Do I have to config Nancy/Owin to use the certificate somehow or is it enough to have it attached to the endpoint with netsh?
I've got it working. I've found it useful to have a number of checks in the process.
CHECK1 - Cert import ok:
- After you install the cert on the machine run certutil -store MY
- You shoudle see the cert details there (sha/user created/name etc)
- If not STOP. You probably imported into the user store (or the cert is invalid). You MUST start with empty mmc and import certificates for the MACHINE.
CHECK2 - url is added to urlacl list in netsh
- After you add the uri to acl run netsh http show urlacl
- If your uri / port is not listed STOP. The url isn't added correctly.
CHECK3 - ssl is bound to urlacl
- After running the add sslcert command run netsh http show sslcert
- If your port/sha combination is not listed then check the sha has no spaces / appid is unique / app id + braces surrounded by quotes (if executing from PS)
Hope it helps. I created the above after 6 hours of head banging. It now works!

netsh command : blocking a port

i'm trying to block/allow the 80 port to block/allow internet access in browsers.
i referred to this article http://support.microsoft.com/kb/947709 about netsh commands.
my command was :
netsh advfirewall firewall add rule name=”allow80” protocol=TCP dir=out localport=80 action=block
the cmd asked me for admin rights, after running with admin rights, running the commands returns ok. but i does absolutely nothing, i'm still allowed to browse the web.
what can be wrong?
change localport=80 to remoteport=80
It seems that you set the local port as tcp 80, but you build an outgoing rule, technically the local port is the source port for this kind of rule because you start a connection to the remote port (destination port) tcp 80 to any site on internet, you must change the localport to remoteport parameter.
Regards.

Servicehost throwing an error, even though added to configuration with netsh

ServiceHost.Open() is throwing this error:
HTTP could not register URL http://+:8001/. Your process does not have
access rights to this namespace (see
http://go.microsoft.com/fwlink/?LinkId=70353 for details).
So I used netsh to add the url. But event though it is added, i'm still getting the error. This is the command I use:
netsh http add urlacl url=http://+:8001/ user=djerryy
djerryy is my computername. When I run netsh http show urlacl i see it was added.
What am I doing wrong?
Thanks in advance.
It looks like you are missing the name of the user account who is running the service. Here's a couple of options:
Local user account:
netsh http add urlacl url=http://+:8001/ user=ComputerName\Username
Domain user account:
netsh http add urlacl url=http://+:8001/ user=DomainName\Username
Built-in NetworkService account:
netsh http add urlacl url=http://+:8001/ user="NT AUTHORITY\NETWORK SERVICE"
I must stress:
netsh http add urlacl url=http://+:8001/ user="NT AUTHORITY\NETWORK SERVICE"
will work only on a system with the English locale!
A better way is to remove that one space and make it:
netsh http add urlacl url=http://+:8001/ user="NT AUTHORITY\NETWORKSERVICE"
Now the command will work on any locale. I spent a good 0,5h battling this today... all because of a single char. ;)
To add even more to this answer: You MUST specify a port number! Spend quite a while trying to authorize a service to bind to a normal HTTP address, it only started working when I explicitly specified:
netsh http add urlacl
url=http://some.example.com:80/extension/
user="NT AUTHORITY\NETWORKSERVICE"