Deploying to IIS web server

Topics: Semantic Logging Application Block
Dec 4, 2014 at 1:31 AM
I am my code working locally fine, but when deploying to IIS it seems to be throwing errors causing my application to stop the Application Pool.
In my Global.asax.cs class I have:
 protected void Application_Start(object sender, EventArgs e)
        {
            ConnectionString = ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString;
            
            listener = new DatabaseEventListener("AppLogQueue", ConnectionString, SqlClientFactory.Instance, TimeSpan.FromSeconds(Convert.ToDouble(ConfigurationManager.AppSettings["LogBufferInterval"])), 0);
            listener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.LogAlways, Keywords.All);
            
        }
and in my SemanticLoggingSource.cs file I have the following method:
  public static SemanticLoggingEventSource Log { get; private set; }

      [Event(100, Level = EventLevel.Error, Keywords = Keywords.EventListener, Message = "{0}" )]
        internal void DatabaseEventListenerError(string message, string SessionId=null)
        {
            if (this.IsEnabled())
            {
                this.WriteEvent(100, message, SessionId);
            }
        }
which can get called by errors in my application as so:
   SemanticLoggingEventSource.Log.DatabaseEventListenerError(LogMessage, sessionId);
As I said this works fine locally and logs my errors in the database but when deploying on the webserver IIS7, I can't even get the application to run. It starts with a service unavailable 503 and I notice the AppPool has been stopped. If I revert all the SemanticLogging code all works fine. What seems to be the block on my webserver to prevent it from running?
Dec 6, 2014 at 4:47 AM
It sounds like an exception is being thrown. Can you capture any startup exceptions and log them using another means (e.g. Eventlog) to identify the error? Or set <customErrors mode="Off" /> to get a stacktrace?

If I were to guess it would be that some of the configuration information is not set properly on the webserver (e.g. LogBufferInterval not set causing conversion to double to fail or perhaps AppConnectionString not defined causing a NullReferenceException).

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to