WCF on Windows 7 not working - wcf

I am using an example from iDesign about one way calls. I can get it to work on a Vista machine (VS2008) but not on a windows 7 machine (VS2010).
I get this error:
HTTP could not register URL http://+:8001/MyService/. Your process does not have access rights to this namespace
ServiceHost host = new ServiceHost(typeof(MyService));
host.Open();
I get the error on the host.Open(); line. I noticed that windows asks first for some firewall and to give permission which I did but still it is not working. What can I do?

This has to do with how the security for vista and later versions of windows deal with port access. The Post below has the command you need to run.
Take a look at this post

Have you reserved that namespace? The link that is in the exception message tells you how, however as you appear to have missed or not gotten that
Open an elevated command prompt and run
netsh http add urlacl url=http://+:8001/MyService/ user=DOMAIN\user
replacing DOMAIN\user with your account details, or a suitable group

Related

VS2019 Cannot launch .NET Core ASP 2 web site and browse from another computer on the same network

I have been trying to browse a website run under IIS Express VS2019 from another computer on the same network. I see the following error.
Bad Request - Invalid Hostname
I found several discussions where people suggested adding bindings and I did try adding so many different bindings in applicationhost.config with specific hostname, IP, hostname+ip, wildcards. When I add any binding or modify the existing localhost binding VS 2019 start giving me the following error
Unable to connect to web server 'IIS Express'
I am running VS2019 as an admin. What else I am missing?
Here is what I discovered. I do not have admin privileges on my local PC. Our sysadmin had created a shortcut for me which launches VS2019 as an admin. However, the VS was still not run as elevated Admin privileges. Turns out, you need to be an admin, and you must right-click the VS2019 shortcut and choose Run As Administrator with a shield and say Yes to the warning. The shortcut wasn't doing none of that. Now my custom IIS Express bindings are picked up from applicationhost.config without any issue.

Windows could not start the Apache CouchDB service on Local Computer

I have installed CouchDB on my Windows machine but while starting the CouchDB service, I am getting a message like:
Windows could not start the Apache CouchDB service on Local Computer. The service did not return an error. This could be an internal Windows error or an internal service error. If the problem persists, please contact your system administrator.
As the service is not running, I am unable to access Fauxton too.
I am using Windows 7. CouchDB is 2.0.0. Port 5984 is not in use.
I don't think your question is a duplicate of https://stackoverflow.com/a/44107335/219187 because you are on Windows 7, and the problem described there is for Windows 10 with the creators update.
But maybe the solution fixes your problem as well? Here is the procedure:
Download the prelease build 2.2.4-101 from https://nssm.cc/download
Stop the CouchDB service through the Windows Services dialog (paused is not enough)
Overwrite nssm.exe in <CouchDbInstallDir>\bin with the one from the downloaded ZIP file (make sure you pick the right version 32 bit / 64 bit)
Start the CouchDB service
Issue it's happening since the last updates released by Microsoft. I'm not completely aware of what's causing it, but I think it's something related to CouchDB service not been able to start using Local Administrator rights.
However I've managed to start the service manually, by doing so:
Open Command Prompt - in the Search from the Start Menu or Task Bar type "cmd"
Run it as an Administrator - right click on the Command Prompt application and choose "Run as administrator" option /this is really IMPORTANT as it will allow the service to have administrator access/
Navigate to the folder where CouchDB is install - default path is "D:/CouchDB", but could be anywhere else; you have to find it
Go to the "bin" folder in there
Type "couchdb" as a command to start the service
You will see a message showing after this - "kernel-poll not supported; "K" parameter ignored"
If it adds some error messages after it or closes the whole terminal, you're making some things bad from this guide, so follow it strictly.
You can now open up the Fauxton application in the browser like normal from here - http://localhost:5984/_utils/
Keep in mind that you have to leave the cmd opened in order the service to be working as expected. As far as I saw no information was lost, so it's all good.
This is a temporary solution though, as we are waiting a relase from either Microsoft or Apache to solve the issue, or at least give us more explanation about it.
i just met the same problem.
the cause is space, you have to install CouchDB in a path without any space, even Program Files folder, because there is a space between Program and Files...

HTTP could not register URL http://+:10001/. Your process does not have access rights to this namespace

I just upgraded from Windows 7/VS2010 to a clean install of Windows 8/VS2012.
I'm logging onto a domain user (domain admin) and have started seeing this error when launching some of my wcf services from VS2012:
HTTP could not register URL http://+:10001/. Your process does not have access rights to this namespace
I've never experienced this before on Windows 7 and I'm a little perplexed why I'm seeing this now in Windows 8 (domain admin, user access control turned off).
With some research I found out that this error arises due to the VS process not running with admin rights and non admins apparently can't listen on TCP ports, however, I don't quite follow why VS wouldn't run as admin as the user I'm logging in to is a domain admin?
You must execute something like this:
netsh http add urlacl url=http://+:10001/YourUri/ user=\Everyone
or
netsh http add urlacl url=http://+:10001/YourUri/ user=DOMAIN\user
Something is mentioned in this article or google for "netsh http add urlacl"
AFAIK since Vista processes do not run with elevated privileges even if launched by Admin account. That is the whole point behind UAC.
However after you run netsh command you will not need anything like that anyway.
You can change Account window to administrator in control panel, it's have all permission to run url.
Make sure, you run both the VS and Command prompt as Administrator.
Execute the command on Command Prompt
netsh http add urlacl url=http://+:10001 user=<your_userid>
Open VS as Administrator

HTTP could not register URL http://+:8000/HelloWCF/. Your process does not have access rights to this namespace

I'm a beginner in WCF, but trying to improve my experience. And on the first step I faced the problem. I created the simplest WCF service. The listing of code: (all the code in one file)
using System;
using System.ServiceModel;
namespace EssentialWCF
{
[ServiceContract]
public interface IStockService
{
[OperationContract]
double GetPrice(string ticker);
}
public class StockService : IStockService
{
public double GetPrice(string ticker)
{
return 94.85;
}
}
class Service
{
static void Main(string[] args)
{
ServiceHost serviceHost = new ServiceHost(typeof(StockService),
new Uri("http://localhost:8000/HelloWCF"));
serviceHost.AddServiceEndpoint(typeof(IStockService), new BasicHttpBinding());
serviceHost.Open();
Console.WriteLine("To continue press ENTER");
serviceHost.Close();
}
}
}
That would be the service that give me a number via console. But debug give me the exception: (instead of number :) )
HTTP could not register URL http://+:8000/HelloWCF/. Your process does not have access rights to this namespace.
Have you ever faced the same situation? I will be glad to see every advice.
Unfortunately the link in the exception text, http://go.microsoft.com/fwlink/?LinkId=70353, is broken. However, it used to lead to http://msdn.microsoft.com/en-us/library/ms733768.aspx which explains how to set the permissions.
It basically informs you to use the following command:
netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user
You can get more help on the details using the help of netsh
For example: netsh http add ?
Gives help on the http add command.
I closed Visual studio IDE and reopened it by right clicking on the Visual Studio icon and saying "Run as Administrator", Then when I ran the host , It worked!!!
Right Click on Visual Studio > Run as Administrator > Open your project and run the service.
This is a privilege related issue.
The simple thing you need to do is to close your Visual Studio environment and open it again by using 'Run as administrator'. It should now run successfully.
You need some Administrator privilege to your account if your machine in local area network then you apply some administrator privilege to your User else you should start ide as Administrator...
You must give permission to your app for listening http requests. You can use this command in cmd for this purpose (open cmd Run As Administrator mode)
netsh http add urlacl url=http://+:8000/ user=Everyone
If your app is working other port, for example 9095, this command must be like as below:
netsh http add urlacl url=http://+:9095/ user=Everyone
And re-run your app, it should work.
This way working for me.
In Windows Vista and later the HTTP WCF service stuff would cause the exception you mentioned because a restricted account does not have right for that. That is the reason why it worked when you ran it as administrator.
Every sensible developer must use a RESTRICTED account rather than as an Administrator, yet many people go the wrong way and that is precisely why there are so many applications out there that DEMAND admin permissions when they are not really required. Working the lazy way results in lazy solutions. I hope you still work in a restricted account (my congratulations).
There is a tool out there (from 2008 or so) called NamespaceManagerTool if I remember correctly that is supposed to grant the restricted user permissions on these service URLs that you define for WCF. I haven't used that though...
Your sample code won't work as shown because you forgot to include a Console.ReadLine() before the serviceHost.Close() line. That means the host is opened and then immediately closed.
Other than that, it seems you have a permission problem on your machine. Ensure you are logged-in as an administrator account on your machine. If you are an administrator then it may be that you don't have the World Wide Web Publishing Service (W3SVC) running to handle HTTP requests.
While I was able to solve this problem in one computer following the other users solutions, the command netsh didn't solve the issue in one of my machines and even though the current user had administrator rights I was still getting the "HTTP could not register URL.... Your process does not have access rights to this namespace". So I'm sharing my solution in case you still don't get it to work with the other solutions too.
After also trying to give write permissions to the user in the physical directory of my website and getting no success, I finally decided trying to change IIS settings.
As the images below show, I configured the Physical Path Credentials of my website to connect as an specifc user, which was an admin account with DOMAIN\username and password, and this was enough to make the error disapear.
Close iis express and all the browsers (if the url was opened in any of the browser). Also open the visual studio IDE in admin mode. This has resolved my issue.
I was getting the same error in a for a domain using a different port (2130). The process was a service. I was able to fix the issue by changin the user running the service from NetworkSystem to Local System Account.
Another thing I might add: If this just for local testing purposes you could try to change the port from 8000 to something else such as 8080 and not get this error. That worked for me at least.

Configuring WCF in IIS7 & Windows 7

I am having a problem when I try to browse WCF service (.svc file) which is hosted in IIS7 & Windows7. It throws following error.
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
I tried to run ServiceModelReg, but it say I should have admin rights in order to run this, although I am admin on this machine.
Does any one know how to resolve this issue.
FInally....
I am able to resolve this issue.
I ran following two command and it solved the problem.
aspnet_regiis -i & ServiceModelReg -i
Even though I am admin on the machine, I need to run this 2 commands by right click and select 'Run as Admin'.
Your issued is answered here. Trying to be short:
When you start the command prompt, can
you right-click on the icon to open it
and select "Run as Administrator"? I
don't know exactly what's the logic
behind that, but on Vista there are
two kinds of administrative users, one
"normal" administrator and one
"elevated" administrator. I'd guess
the tool needs the second kind.
and second
Also, Why do you need to run
Servicemodelreg.exe on VIsta?
Officially this is not supported on
Vista. Instead you can go to WIndows
features menu throught Add remove
programs and enabled Http Activation
under .Net framework 3.0 feature.
This will enable everything you might
want to do via Servicemodelreg.exe.
Edit
And also here.
If you go into IIS Manager and double click on Handler Mappings do you have *.svc paths listed?
If they are missing this link may help http://msdn.microsoft.com/en-us/library/ms752252(v=vs.90).aspx