Re: Problem with self hosting under the NetworkService account
- From: "Dave Burns" <dburns@xxxxxxxxxxxxxxxx>
- Date: Wed, 5 Nov 2008 11:01:34 -0600
I see this problem on XP as well. On Vista I run as an Administrator, on XP
as well during the install of the service.
Also, I am not getting an AddressAccessDeniedException, I am getting an
NullReferenceException.
Any other ideas?
Thanks, Dave
""Steven Cheng"" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:R8AgTjvPJHA.312@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Dave,
From your description, your windows service hosted WCF service report
exception at startup time, correct?
According to the error message and code snippet you provided, I think the
code and configuration should be ok. And since changing account will make
the result different, the problem is likely to be a permission specific
issue.
So far, based on my experience, there is a potential issue(which might be
caused by unsufficient permission) when initilaize the WCF host. That's
the
registring of the http listening url on vista machine. Based on the
computer name and wcf configuration, I think your dev box is a vista box
and you're using http channel, therefore, I think it is likely the cause.
Here is a web article which mentioned detailed information on registering
http url on vista machine(for a certain user account). You can try
granting
the http url (You want to use for your WCF endpoint) access permission to
the service account:
#AddressAccessDeniedException: HTTP could not register URL
http://+:8080/<¡>.
http://blogs.msdn.com/paulwh/archive/2007/05/04/addressaccessdeniedexception
-http-could-not-register-url-http-8080.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we
can improve the support we provide to you. Please feel free to let my
manager know what you think of
the level of service provided. You can send feedback directly to my
manager
at: msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from
the community or a Microsoft Support Engineer within 2 business day is
acceptable. Please note that
each follow up response may take approximately 2 business days as the
support professional working
with you may need further investigation to reach the most efficient
resolution. The offering is not
appropriate for situations that require urgent, real-time or phone-based
interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support
Engineer
by contacting Microsoft
Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "Dave Burns" <dburns@xxxxxxxxxxxxxxxx>
Subject: Problem with self hosting under the NetworkService account
Date: Tue, 4 Nov 2008 12:53:41 -0600
I am self hosting a Web Service in a Windows service. I am trying to start
the service using the NT AUTHORITY\NetworkService account.
I get a NullReferenceException on ServiceHost.Open() in the
ServiceBase.OnStart() method. SCM throws a 1067 error as well.
I get the same problem with NT AUTHORITY\LocalService.
When I use the LocalSystem account, my domain account, or another regular
user account, the windows service starts just fine.
I would appreciate any help on this topic, thanks in advance!
Dave
Here's the code snippet:
class HostService : ServiceBase
{
private EventLog log;
private ServiceHost testServiceHost;
public HostService()
{
CanPauseAndContinue = false;
ServiceName = "Test Web Service";
// create an EventLog instance and assign its source.
this.log = new EventLog();
this.log.Source = HostInstaller.SERVICE_EVENT_SOURCE;
EventLog.WriteEntry("Got through constructor",
EventLogEntryType.Information);
}
static void Main()
{
// load the service into memory.
ServiceBase.Run(new HostService());
}
// start the service.
protected override void OnStart(string[] args)
{
EventLog.WriteEntry("At the top of OnStart",
EventLogEntryType.Information);
// request 60 seconds for startup from SCM, just in case
RequestAdditionalTime(60000);
EventLog.WriteEntry("After RequestAdditionalTime()",
EventLogEntryType.Information);
// start self hosting
ServiceEndpoint endpoint = null;
try
{
endpoint = this.testServiceHost.Description.Endpoints[0];
this.testServiceHost = new ServiceHost(typeof(RmTestService));
EventLog.WriteEntry("After new ServiceHost()",
EventLogEntryType.Information);
// blows up here!!!
this.testServiceHost.Open();
}
catch (Exception e)
{
EventLog.WriteEntry("Problem starting " +
endpoint.Contract.Name
+ ": " + e.Message, EventLogEntryType.Error);
throw e;
}
}
Here's app.config snippet:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="RmWebService.RmWebServiceBehavior"
name="Rimage.Web.Service.RmTestService">
<host>
<baseAddresses>
<add
baseAddress="http://vista-draskin:55555/RmTestService.svc"/>
</baseAddresses>
</host>
<endpoint address="http://vista-draskin:55555/RmTestService.svc"
binding="basicHttpBinding" name="SoapEndpoint"
bindingNamespace="http://www.rimage.com/RmTestService"
contract="Rimage.Web.Service.IRmTestService"
listenUriMode="Explicit">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="MexEndpoint"
bindingNamespace="http://www.rimage.com/RmTestService"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior
name="Rimage.Web.Service.RmAjaxTestServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="RmWebService.RmWebServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
.
- Follow-Ups:
- Re: Problem with self hosting under the NetworkService account
- From: "Steven Cheng"
- Re: Problem with self hosting under the NetworkService account
- References:
- Problem with self hosting under the NetworkService account
- From: Dave Burns
- RE: Problem with self hosting under the NetworkService account
- From: "Steven Cheng"
- Problem with self hosting under the NetworkService account
- Prev by Date: Re: Sending custom objects through WCF
- Next by Date: Re: Problem with self hosting under the NetworkService account
- Previous by thread: RE: Problem with self hosting under the NetworkService account
- Next by thread: Re: Problem with self hosting under the NetworkService account
- Index(es):
Relevant Pages
|