.net – The source was not found, but some or all event logs could not be searched using SignalR

asp.net-mvcasp.net-mvc-4netsignalr

I deployed an MVC4 application (that uses SignalR) to a server. SignalR works fine when I run it on my dev machine but when I run it after deploying it to the server I get the following error. I think it has to do with something not having permissions to write to the Event Log. I looked at this answer but those solutions did not work for me. Can someone shed some light?

System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security.

Server stack trace: at
System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly, Boolean wantToCreate) at
System.Diagnostics.EventLog.SourceExists(String source, String
machineName, Boolean wantToCreate) at
System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String
sourceName, String currentMachineName) at
System.Diagnostics.EventLogInternal.WriteEvent(EventInstance instance,
Byte[] data, Object[] values) at
System.Diagnostics.EventLog.WriteEvent(EventInstance instance,
Object[] values) at
System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType,
Int32 id, String format, Object[] args) at
Microsoft.AspNet.SignalR.Transports.TransportHeartbeat.<>c__DisplayClass2.b__1(String
key, ConnectionMetadata old) at
System.Collections.Concurrent.ConcurrentDictionary2.AddOrUpdate(TKey
key, TValue addValue, Func
3 updateValueFactory) at
Microsoft.AspNet.SignalR.Transports.TransportHeartbeat.AddConnection(ITrackingConnection
connection) at
Microsoft.AspNet.SignalR.Transports.ForeverTransport.ProcessReceiveRequest(ITransportConnection
connection) at
Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext
context) at Microsoft.Owin.Host.SystemWeb.OwinCallContext.Execute()
at
Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.BeginProcessRequest(HttpContextBase
httpContext, AsyncCallback callback, Object extraData)

Exception rethrown at [0]: at
Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.<>c__DisplayClass1.b__0(Exception
ex) at
Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult
result) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) The Zone of the assembly that failed
was: MyComputer

Best Answer

For testing you can set an admin user as Identity of your application pool. By default the value is ApplicationPoolIdentity.

enter image description here

If it works you should add permission for the Network Service and add it as user of your app pool. You should add permission to this user on this registry key : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security

Related Topic