Skip to content

Fixed WCF Azure Service Bus: Access is denied Exception

Robert Greiner
Robert Greiner
1 min read
Access is denied.

Really?! Could you be a little more explicit?

The Background

I ran into this error recently when trying to deploy an application at a client. We ended up spending way too much time figuring out the root cause of this exception due to the sheer lack of details. Worst of all, the exact same code was working just fine in our QA environment.

At the end of the day, it turned out that our production box did not have the custom Event Log Source that our logger was attempting to log to. Normally, Windows is kind enough to create the Event Log Source for you, but the application we were running did not have sufficient privileges (Access is denied). After we added the source manually, everything started working again.

The Stack Trace

Unhandled Exception

Unhandled Exception: ***** Exception***** Exception Message: Access is denied. Stack Trace:

Unhandled Exception: ***** Exception***** Exception Message: Access is denied. Stack Trace:

Server Stack Trace

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Rethrown

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

The Fix

To fix this error, create the event log source on your production machine. If your application lives in Windows Azure, you will need to perform a few extra steps.

C:\PS> New-Eventlog -source YourEventLog -logname Application

Please let me know if this saves you any time/hassle. I need something to make me feel better for all of the time I wasted trying to fix this issue.

Happy debugging.

Please consider subscribing, it's free.
Technology

Robert Greiner Twitter

Professional optimist. I write a weekly newsletter for humans at the intersection of business, technology, leadership, and career growth.


Related Posts

Members Public

Navigating the Upside Down as a Technology Leader

Ideas for leading technology organizations with confidence and creativity.

Navigating the Upside Down as a Technology Leader
Members Public

Artist for a Day

The future of creative output is multiplied by AI.

Artist for a Day
Members Public

The Auto Industry's Cloud Awakening

Auto manufacturers are behind the cloud adoption curve but are well-positioned to unlock the future of mobility by building foundational capabilities across six key areas.

The Auto Industry's Cloud Awakening