Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI all,

I built an WCF Service Library, by using Visual Studio 2008.
(I am running Win 7.)

I put in the endpoints that Im going to use.
It generates automatically wsHttpBinding and mexHttpBinding that has IMetadataExchange. In this file there is generated an <baseaddress> tag with standard BaseAddress.

Problem:
When you configure the base address to your liking “http://localhost:8080/TestService” through the configuration panel by right clicking the app.config in solution explorer and clicking host and save it all. Then when you hit F5 and try it, it will generate an error message and not start.
Errormessage : System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8080/TestService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied

There are obviously some ID problem with the new baseaddress.

Question:
1) Is it possible to alter app.config file, so it will be automated?
2) What should I do to solve the problem?

Please, Don´t send me on wild goose chases.
Thanks for you time.
Posted
Updated 19-Jan-11 21:44pm
v4
Comments
Hiren solanki 20-Jan-11 1:52am    
I think just replacing wsHttpBinding with basicHttpBinding in config may help you.
pluss400 20-Jan-11 2:27am    
Hi. What about mexHttpBinding. It uses the baseaddress to? The baseaddress is http://localhost:8731/Design_Time_Addresses/TestService". When I alter or remove this bit "Design_Time_Addresses" in the address it crashes.
pluss400 20-Jan-11 2:38am    
After the change to basicHttpBindig It still generates the same error.
Hiren solanki 20-Jan-11 3:22am    
it 'basicHttpBinding' you missed 'n' inside.
pluss400 20-Jan-11 3:38am    
You got to be kiding me: endpoint address="basic" binding="basicHttpBinding" bindingConfiguration=""
contract="TestServiceLibrary.ITestService"
IT DONT WORK!

hi,

Found an answer here

http://social.msdn.microsoft.com/Forums/en/wcf/thread/78b1f2dd-7fa1-4ca4-87e1-d26169948603[^]

You need to look up some VBS to get your username GUID which is

Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_GUID = 7

strUserName = "Domain\username"

Set objTranslator = CreateObject("NameTranslate")

objTranslator.Init ADS_NAME_INITTYPE_GC, ""
objTranslator.Set ADS_NAME_TYPE_NT4, strUserName

strUserGUID = objTranslator.Get(ADS_NAME_TYPE_GUID)

Wscript.Echo strUserGUID
 
Share this answer
 
Comments
pluss400 21-Jan-11 13:58pm    
Thanks. I have being looking at this before. There is 2 problems with this solution. The application I´m building, is a sensitive one. It can’t be halted for long time.
1) When I give the compiled application to my friend and he get the error message. What shall he do? He knows nothing about computers, and it should not work this way.
2) If I want to do an update in the future, which I most certainly will. It´s no easy task. Installing, compiling and so forth. The computer will be reboted.
So. There must be an XML alternative in app.config.
pluss400 22-Jan-11 6:25am    
I’m sorry. I’m allergic to VB at all. But you gave me an idea. I can hardcode the authorization before starting the service. In .NET code.
Have a nice day.
Your problem isn't in the code or app. It's the permission Windows let's you have to start the WCF service. You need to give your username the permission to start a web service which is what the command in the app does. You do however need your unique username identifier which is what you get with the VBS script.
 
Share this answer
 
To hopingToCode.
Ok. I´m quite new at certificates. So HTTP Imetatdata attempts to start a web service. It has to be verified by windows. It uses x509 certificate to get clearance.

<pre><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
           istenUriMode="Explicit">
   <identity>
      <dns value="localhost" />
      <certificatereference storename="My" storelocation="LocalMachine">
            x509FindType="FindBySubjectDistinguishedName" />
   </certificatereference></identity></endpoint>



Question:
1) Where do I Put my username identifier when I got it?
2) When everything is finished and compiled. I take this to a new computer. What happens then?

Thanks. Hope for a reply.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900