locked
AHHH!!! MY WCF SERVICE!!! WHATS GOING ON!? RRS feed

  • Question

  • I have been fighting my WCF service for about 4 days straight now... I FINALY got past the error with metadata referance error but now i get this error

    System.ServiceModel.AddressAccessDeniedException: 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). ---> System.Net.HttpListenerException: Access is denied
       at System.Net.HttpListener.AddAll()
       at System.Net.HttpListener.Start()
       at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
       --- End of inner exception stack trace ---
       at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
       at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
       at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
       at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open()
       at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)Access is denied

     

    HELP ME! PLEASE!(ha ha that was so unnesssisary) I'm SOOO lost right now its rediculous.

    Sunday, March 1, 2009 10:51 AM

Answers

  • how could this have been the issue all along?
     

    Was the issue the port number?

    It's always sketchy using reserved port numbers.  Ports in the 49152-65535 range are a much safer choice.

    Mark

     

     

     

    No, Turns out it was as simple as using visual studio in admin mode Angry

    That is so frustrating because I could have done that so simply and I would have saved 3 days on this problem. Thank god this project is a personal non-buisness-critial one.

    Monday, March 2, 2009 4:22 PM

All replies

  • Did you try a different portnumber? It looks like your machine is under a domain policy. At least that's what I understand from the url in your stacktrace.
    Sunday, March 1, 2009 11:28 AM
  • well the service has a crossdomain policy and the port is 8001. So do i try changing the ports?

    Sunday, March 1, 2009 11:34 AM
  • I think that would be a good idea. Besides that, are you hosting it inside IIS or do you have your own WCF hosting application?
    Sunday, March 1, 2009 11:44 AM
  • Well currently I'm trying to just getting running in debug with visual studio so i can add the referance to my silverlight app.

    And by changing the ports, would changing them in the config file be enough?

    Sunday, March 1, 2009 11:50 AM
  • If you're hosting it inside the Development Web Server it won't be enough. You will have to change that as well I think. It's in the web project's properties window.
    Sunday, March 1, 2009 12:02 PM
  • Oh really? but visual studio has some tool it has there, Idk if it uses the development server. So do I use IIS7 cause I'm Windows 7. and also for the web properties, in my solution I have the WCF service, Silverlight app, and Silverlight website. So by web properties you mean the config for the service or the properties for the website?

    Sunday, March 1, 2009 12:09 PM
  • Yea visual studo uses "WCF serviceHost". It's some application. BTW I'm using Visual studio 2008 with a real service not a silverlight enabled service.

    Sunday, March 1, 2009 12:12 PM
  • Ah you're using Windows 7. Might this Beta product be the problem?
    Sunday, March 1, 2009 12:19 PM
  • No I dont think so becuase if i run a differnt service(One I created blank) It runs fine and you can call it perfectly. It seems to be this service specificaly

    Sunday, March 1, 2009 12:31 PM
  • Here is my App.Config....

    1    
    2    <configuration>
    3      <system.web>
    4        <compilation debug="true" />
    5      </system.web>
    6    
    7      <!--When deploying the service library project, the content of the 
    8    		config file must be added to the host's app.config file. 
    9    		System.Configuration does not support config files for libraries. -->
    10   
    11     <system.serviceModel>
    12       <behaviors>
    13         <endpointBehaviors>
    14         </endpointBehaviors>
    15         <serviceBehaviors>
    16           <behavior name="pop3Service.Pop3ServiceBehavior">
    17             <!--	To avoid disclosing metadata information, 
    18   				set the value below to false and remove the metadata endpoint 
    19   				above before deployment -->
    20             <serviceMetadata httpGetEnabled="true"/>
    21             <!--	To receive exception details in faults for debugging purposes,
    22   				set the value below to true.  Set to false before deployment to 
    23   				avoid disclosing exception information -->
    24             <serviceDebug includeExceptionDetailInFaults="true" />
    25           </behavior>
    26         </serviceBehaviors>
    27       </behaviors>
    28       <services>
    29         <service behaviorConfiguration="pop3Service.Pop3ServiceBehavior" name="pop3Service.pop3Service">
    30           <endpoint address="pop3Service/pop3Service" binding="basicHttpBinding" bindingConfiguration="HTTPBindingConfig" contract="pop3Service.IPop3Service" />
    31           <endpoint address="net.tcp://localhost:8002/pop3Service/pop3Service" binding="netTcpBinding" bindingConfiguration="TCPBindingConfig" contract="pop3Service.IPop3Service" />
    32           <endpoint address="net.pipe://pop3Service/pop3Service" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBindingConfig" contract="pop3Service.IPop3Service" />
    33           <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    34           <host>
    35             <baseAddresses>
    36               <add baseAddress="http://localhost:8001/" />
    37             </baseAddresses>
    38           </host>
    39         </service>
    40       </services>
    41       <bindings>
    42         <basicHttpBinding>
    43           <binding name="HTTPBindingConfig" receiveTimeout="00:10:00" allowCookies="true" sendTimeout="00:10:00" transferMode="Streamed" />
    44         </basicHttpBinding>
    45         <netTcpBinding>
    46           <binding name="TCPBindingConfig" transferMode="Buffered" maxBufferSize="65536" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" portSharingEnabled="false">
    47             <security mode="Transport" />
    48           </binding>
    49         </netTcpBinding>
    50         <netNamedPipeBinding>
    51           <binding name="NamedPipeBindingConfig" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536" receiveTimeout="00:10:00" transactionFlow="false">
    52             <security mode="Transport" />
    53           </binding>
    54         </netNamedPipeBinding>
    55       </bindings>
    56     </system.serviceModel>
    57   
    58   </configuration>

    And Here is my Crossdomainpolicy.xml

    1    
    2    <access-policy>
    3      <cross-domain-access>
    4        <policy>
    5          <allow-from http-request-headers="*">
    6            <domain uri="*"/>
    7          </allow-from>
    8          <grant-to>
    9            <resource include-subpaths="true" path="/"/>
    10         </grant-to>
    11       </policy>
    12     </cross-domain-access>
    13   </access-policy>
    
     
    Sunday, March 1, 2009 12:39 PM
  • Do you have a reason to add all those different bindings? I think HTTP is enough, right? Besides that I see still a baseAddress containing port 8001.
    Sunday, March 1, 2009 12:54 PM
  • well truth is this is pulled from a differnt project and changed to this project so that one needed all those bindings. I just left them. Now it's true that its 8001. What is it I need to do, change that?

    Sunday, March 1, 2009 1:04 PM
  • I think it will be good to remove everything that's not needed. Like the following endpoints: net.tcp and net.pipe. Besides that also remove the corresponding bindings: netTcpBinding and netNamedPipeBinding. Can you post the changed config file after you changed this?
    Sunday, March 1, 2009 1:43 PM
  • The New app.config file

    1    
    2    <configuration>
    3      <system.web>
    4        <compilation debug="true" />
    5      </system.web>
    6    
    7      <!--When deploying the service library project, the content of the 
    8    		config file must be added to the host's app.config file. 
    9    		System.Configuration does not support config files for libraries. -->
    10   
    11     <system.serviceModel>
    12       <behaviors>
    13         <endpointBehaviors>
    14         </endpointBehaviors>
    15         <serviceBehaviors>
    16           <behavior name="pop3Service.Pop3ServiceBehavior">
    17             <!--	To avoid disclosing metadata information, 
    18   				set the value below to false and remove the metadata endpoint 
    19   				above before deployment -->
    20             <serviceMetadata httpGetEnabled="true"/>
    21             <!--	To receive exception details in faults for debugging purposes,
    22   				set the value below to true.  Set to false before deployment to 
    23   				avoid disclosing exception information -->
    24             <serviceDebug includeExceptionDetailInFaults="true" />
    25           </behavior>
    26         </serviceBehaviors>
    27       </behaviors>
    28       <services>
    29         <service behaviorConfiguration="pop3Service.Pop3ServiceBehavior" name="pop3Service.pop3Service">
    30           <endpoint address="pop3Service/pop3Service" binding="basicHttpBinding" bindingConfiguration="HTTPBindingConfig" contract="pop3Service.IPop3Service" />
    31           <!--<endpoint address="net.tcp://localhost:8002/pop3Service/pop3Service" binding="netTcpBinding" bindingConfiguration="TCPBindingConfig" contract="pop3Service.IPop3Service" />
    32           <endpoint address="net.pipe://pop3Service/pop3Service" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBindingConfig" contract="pop3Service.IPop3Service" />-->
    33           <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    34           <host>
    35             <baseAddresses>
    36               <add baseAddress="http://localhost:8001/" />
    37             </baseAddresses>
    38           </host>
    39         </service>
    40       </services>
    41       <bindings>
    42         <basicHttpBinding>
    43           <binding name="HTTPBindingConfig" receiveTimeout="00:10:00" allowCookies="true" sendTimeout="00:10:00" transferMode="Streamed" />
    44         </basicHttpBinding>
    45         <!--<netTcpBinding>
    46           <binding name="TCPBindingConfig" transferMode="Buffered" maxBufferSize="65536" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" portSharingEnabled="false">
    47             <security mode="Transport" />
    48           </binding>
    49         </netTcpBinding>
    50         <netNamedPipeBinding>
    51           <binding name="NamedPipeBindingConfig" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536" receiveTimeout="00:10:00" transactionFlow="false">
    52             <security mode="Transport" />
    53           </binding>
    54         </netNamedPipeBinding>-->
    55       </bindings>
    56     </system.serviceModel>
    57   
    58   </configuration>
    Sunday, March 1, 2009 5:15 PM
  • This looks fine right now. You have only the the basicHttpBinding with the metadata service, just about everything you need. Do you have the some problems right now?
    Monday, March 2, 2009 1:07 AM
  • System.ServiceModel.AddressAccessDeniedException: 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). ---> System.Net.HttpListenerException: Access is denied
       at System.Net.HttpListener.AddAll()
       at System.Net.HttpListener.Start()
       at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
       --- End of inner exception stack trace ---
       at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
       at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
       at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
       at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open()
       at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)Access is denied

    Hello, Have you checked this article? http://mark.michaelis.net/Blog/WindowsCommunicationFoundationWithWindowsVistaAndUAC.aspx Are you using Vista for your developmenet machine?
    Monday, March 2, 2009 1:39 AM
  • He's using Windows 7.
    Monday, March 2, 2009 2:48 AM
  • Oh gosh I think this is it... I'm going to check this...

    Monday, March 2, 2009 3:51 PM
  • This is rediculous, how could this have been the issue all along?

    Thanks both of you for all your help. I wish i could mark both of you answers because I think you guys deserve it. But it would be confusing to others so I can't, nor do i think this thing will let me.

    Monday, March 2, 2009 3:55 PM
  • how could this have been the issue all along?
     

    Was the issue the port number?

    It's always sketchy using reserved port numbers.  Ports in the 49152-65535 range are a much safer choice.

    Mark

     

     

     

    Monday, March 2, 2009 4:08 PM
  • how could this have been the issue all along?
     

    Was the issue the port number?

    It's always sketchy using reserved port numbers.  Ports in the 49152-65535 range are a much safer choice.

    Mark

     

     

     

    No, Turns out it was as simple as using visual studio in admin mode Angry

    That is so frustrating because I could have done that so simply and I would have saved 3 days on this problem. Thank god this project is a personal non-buisness-critial one.

    Monday, March 2, 2009 4:22 PM
  • No, Turns out it was as simple as using visual studio in admin mode
     

    Ah!  Bummer :)  

    Thanks for the update though - I've never seen that one, but I always have VS running elevated so I can attach to Windows service apps with the debugger.

    Cheers,
    Mark

    Monday, March 2, 2009 4:35 PM
  • Turns out it was as simple as using visual studio in admin mode
     

    Oh. anyway, glad to hear that your issue has been solved. :) 

    Tuesday, March 3, 2009 12:06 AM
  • Good to read you solved it ;-). So had something to do with Windows 7 in the end :-).
    Tuesday, March 3, 2009 1:25 AM