Technical: Microsoft – SQL Server / Internet Information Server (IIS) – OData – Service – Error Logging
As a follow-up to Technical: Microsoft – SQL Server / Internet Information Server (IIS) – OData – Service ( https://danieladeniji.wordpress.com/2013/07/30/technical-microsoft-sql-server-internet-information-server-iis-odata-service/ ) , let us discuss error logging.
The impetus to explicitly address error logging was seeded by this error message:
The server encountered an error processing the request. See server logs for more details.
Launch Visual Studio
Launch Visual Studio and load our project.
In Solution Explorer, right click on the Application’s Configuration file. Note that if this is a Web Project the name of the configuration file will be web.config and if it a Console Application, it will be named App.config.
Please be sure to choose the generic configuration file. In the case of a web project, choose web.config file and not the web.debug.config nor the web.release.config.
Once you right click on App’s Config file, a drop-down menu will appear. From the drop-down menu an entry labelled “Edit WCF Configuration” will be visible.
If the “Edit WCF Configuration” menu item is not present, access the main menu and click on the menu items “Tool”\WCF Service Configuration Editor”. Exit the ensuring “WCF Service Configuration Editor” as changes made here are disjointed from our App’s Configuration. Return to the App Configuration and click on the now visible “Edit WCF Configuration”.
WCF Configuration Choices
Access the Diagnostics section and use the provided hyperlinks
- WMI Provider (checked)
- Log Auto Flush (checked)
- MessageLogging (checked)
- Tracing (checked)
- Trace Level – Warning \ Activity Tracing (checked)
- LogEntireMessage (checked)
- LogKnownPii (checked)
- LogMalformedMessages (checked)
- LogMessagesAtServiceLevel (checked)
- LogMessageaAtTransportLevel (checked)
OS Folder & File Level Permissions
Depending on the folder where the Log File will be kept, please ensure that the Account that your Web Pool is running has OS Level folder permissions to that folder.
Review Log File
Conventionally, the log file’s extension is svclog. And, the OS is configured to rely on the Microsoft Trace File Viewer to view changes being logged in that file.
To launch “Trace File Viewer” access Windows Explorer and sojourn to your Log Folder, select your log file, and choose to view using the aforementioned utility.
Sample Errors – Error EntitySet Name
I intentionally entered the wrong “Entity Set” name:
Note that the our entity set name is clients and not xclients.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The given name 'xclients' was notfound in the entity sets. Parameter name: name
Editor Error Messages
During the course of using the GUI to effect configuration changes, we ran into an error stating:
propagateActivity is a duplicate name
The only way we were able to get a bit ahead of that logjam was to use an editor (notepad++ for me) and remove wholesale the configuration section area of our configuration file (web.config) and reload the uncluttered file.
Please be sure to effect this change in the generic web.config file and not the web.debug.config nor the web.release.config.