views:

297

answers:

2
+1  Q: 

Windows 7 and WCF

Hi,

When moved to Windows 7 platform a WCF call from ASP.NET project throws exception

  ex {"HTTP could not register URL http://+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."} System.Exception {System.ServiceModel.AddressAccessDeniedException}

+  [System.ServiceModel.AddressAccessDeniedException] {"HTTP could not register URL http://+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."} System.ServiceModel.AddressAccessDeniedException

+  InnerException {"Access is denied"} System.Exception {System.Net.HttpListenerException}
  Message "HTTP could not register URL http://+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)." string
  Source "System.ServiceModel" string

+  TargetSite {Void OnOpen()} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
+3  A: 

Are you sure that's from an outbound call? That is the error you get on Windows 7 (and Vista and Windows 2008) when you try to open a WCF "server" for listening. This happens if you attempt to create an endpoint without registering it. On the client it can happen if its a duplex service as, of course, the client then needs to open an endpoint.

The KB article linked to in the exception has instructions on how to register an endpoint. Basically you run the following in an elevated command prompt.

netsh http add urlacl url=//+:9100/Jfc.Dealing.OrderProvider.BLClient.svc/ user=DOMAIN\Network Service

Replace DOMAIN with your machine name and it should be right for your machine.

blowdart
I'm so used to ignoring those links in the exceptions that I didn't even think about trying that. Your example worked great for me (except I couldn't get it to accept Network Service, so I used myself). It's a shame I'll have to do this for every port I want to host a service on, though.
Ecyrb
Ah what you can do then is to reserve a prefix and reserve something like //+9100/Ecyrb/ and then put each service on that port/Ecryrb so, for example http://localhost:9100/Ecyrb/Service1.svc/ and http://localhost:9100/Ecyrb/Service2.svc/
blowdart
+2  A: 

Well, if you follow the link that is included in the exception and read what it says you have the answer. Run the command:

netsh http add iplisten ipaddress=0.0.0.0:9100
klausbyskov