Configuring AzureTableStorage Serilog sink from config file - serilog

Can the Azure Table Storage sink for Serilog be configured via the app/Web.config like other sinks, eg Elasticsearch and Seq, which can be configured from the configuration files.
The github page for AzureTableStorage sink shows only code based configuration.
Thanks

I was able to figure this out:
<add key="serilog:using" value="Serilog.Sinks.AzureTableStorage" />
<add key="serilog:write-to:AzureTableStorageWithProperties.connectionString" value="DefaultEndpointsProtocol=https;AccountName=someaccount;AccountKey=uJeYNoa/4dKKtH3zG+7YlA==;EndpointSuffix=core.windows.net" />
<add key="serilog:write-to:AzureTableStorageWithProperties.storageTableName" value="my-logs" />
With this, am able to see the logs coming in StorageExplorer

Related

How to deploy Dart server to IIS

I want to deploy a basic dart server that uses shelf to an IIS server.
I ran the command dart compile exe and tried to place the executable along with the web.config file in a file system. I set up the workpool with the settings I need. I have a DNS ready which is mywebsite.reu.po and set up the proper bindings for it. It gives me a 503 error something about handlers. The server host name is localhost and the port is whatever APSNET_PORT is. If nothing is found in that port, then it grabs port 4000.
Here is what I have in my web.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\server.exe" />
</system.webServer>
</configuration>
So I figured out the solution for this. I had to change the identifier for the pool since there are multiple admin accounts for the IIS. However, only one account has the ability to do hosting. Go to the pool, advance settings, and change the identifier with the right admin credentials.

NuGet.Config file Transforms?

Is there a way to transform a Nuget.Config file in a solution based on the solution configuration? I have one packageSource that I only use for resolving dependencies on my local machine. I don't want this packageSource to be used at all when I build the solution on the build server.
<?xml version="1.0" encoding="utf-8"?>
<packageSources>
<clear />
<add key="MyLocalFeed" value="\\MyNetworkShare" />
<add key="CompanyFeed" value="http://companynugetserver/" />
</packageSources>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
In the above sample Nuget.Config, I only want to use "MyLocalFeed" on my local development server ("Debug" configuration in the solution). Once all changes are checked-in and built on the build server, the "MyLocalFeed" packageSource should no longer appear/be ignored. I have to keep the <clear /> statement in the config, per company requirements.
No, we cannot transform a Nuget.Config file in a solution based on the solution configuration.
Based on your description you can use the "MyLocalFeed" for local development, and remove "MyLocalFeed" in the Nuget.Config file and use that file in TFS build to restore the packages from CompanyFeed.
But please note that the local packages may have other dependencies which are not included in CompanyFeed...
So we recommend using the same NuGet feed for development and CI, or you push all the related packages into theCompanyFeed.

Implement quartz.net through configuration

I need to shedule some task through the Quartz.net. I want to configure the trigger and jobdetails through the config file. Is there any way?
It seems that the configuration and/or implementation has changed in Quartz 2. You will have to include this in your config:
<add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz"/>
in addition to your other configuration settings in the <quartz> node. Hope this helps.
You can use XMLSchedulingDataProcessorPlugin:
This plugin loads XML file(s) to add jobs and schedule them with triggers as the scheduler is initialized, and can optionally periodically scan the file for changes.
if you not have a XML or Config only for the job then remove all keys with value Quartz.Plugin in the Web Config and set only
<add key="quartz.scheduler.instanceName" value="XmlConfiguredInstance" />
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="5" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

Log4Net works on Dev machine, fails when deployed to shared host (using same db/connstring)

I have log4net configured and working fine on my local machine, however when I deploy to my host (godaddy) it fails silently. I am using the same database/config file on my dev machine, and on the host. My log4net reference is set to copy local, and the log4net.dll, .pdb, and .xml exist in the bin on the host. This is an asp.net mvc app.
Edit: No exceptions are thrown, and the application runs as expected (minus the logging)
This is running on SQL Server 2005
The webhost is IIS 7
salient details of my config are:
<root>
<level value="DEBUG" />
<appender-ref ref="AdoNetAppender" />
</root>
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="1" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Anybody have any ideas on things to check?
In my experience, log4net usually swallows any internal errors, simply resulting in log statements that do not produce any results.
What you may want to try is enable log4net's internal logging. You can do this by adding the following to your appSettings section:
<add key="log4net.Internal.Debug" value="true" />
This sets the property LogLog.InternalDebugging to true. log4net will now log to the standard output and error streams and to configured trace listeners.
You can use the following configuration to capture any messages logged to tracing:
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\TextWriterOutput.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
All messages logged by log4net internally will appear in TextWriterOutput.log. If you get a SecurityException when you add the trace listener to your configuration, then very probably the apppool identity does not have sufficient rights to create a file at the specified location (in the example: c:\). Try another location or give the apppool identity sufficient rights.
I've just been able to resolve this problem by downloading and using the latest build of log4net (revision 1072765) from SVN repository http://svn.apache.org/viewvc/logging/log4net/trunk/
Apparently this problem has been fixed long time ago but who knows when log4net 1.2.11 is going to be released.

How to upload web.config file using WebDAV on IIS7?

I want to copy an ASP.NET MVC website to a remote IIS 7 server using WebDAV. I have created a site in IIS, enabled WebDAV and assigned a special application pool I have named "WebDAV Application Pool". Using a Windows 7 or Vista client I'm able to mount the remote site as a network drive. So far, so good.
However, I have problems uploading web.config files to the remote site. One problem is that as soon as a web.config has been uploaded it is used to configure the WebDAV site. The web.config file in a Views folder of a MVC project effectively blocks access to that folder.
To work around this problem I have configured the application pool in the applicationHost.config file:
<configuration>
<applicationPools>
<add name="WebDAV Application Pool"
autoStart="true"
enableConfigurationOverride="false" />
</applicationPools>
</configuration>
The interesting part is the 'enableConfigurationOverride` attribute:
When true, indicates that delegated settings in Web.config files will processed for applications within this application pool. When false, all settings in Web.config files will be ignored for this application pool.
Doing this makes it possible to upload a web.config file to the Views folder without breaking access to the folder.
However, I'm still unable to upload a web.config file to the root folder. I have the following settings in the applicationHost.config file to ensure that request filtering doesn't interfere with WebDAV:
<configuration>
<location path="webdav.mysite.tld">
<system.webServer>
<security>
<requestFiltering>
<fileExtensions applyToWebDAV="false" />
<verbs applyToWebDAV="false" />
<hiddenSegments applyToWebDAV="false" />
</requestFiltering>
</security>
</system.webServer>
</location>
</configuration>
In particular hiddenSegments will normally block access to web.config but setting the applyToWebDAV attribute to false should ensure that this file isn't blocked when using WebDAV.
Unfortunately, I'm still unable to copy my web.config file to the root folder of the site. Doing drag and drop in Windows Explorer to the mapped WebDAV network drive will result in the following error message:
Error 0x80070057: The parameter is incorrect.
On the wire it seems that the HTTP status 400 Bad Request is returned.
Is there anything I can do to configure WebDAV on IIS 7 to avoid this problem?
Followup
Currently I'm unable to reproduce the problem I described above. Perhaps I had to restart something or some other unknown factor fixed my problem. The bottom line is that I now can publish a web site using WebDAV.
1) Open up %windir%\system32\inetsrv\config\schema\WEBDAV_schema
2) Add the following inside of the configSchema section
<sectionSchema name="system.codedom">
<element name="compilers">
<collection addElement="compiler" removeElement="remove" clearElement"clear">
<attribute name="language" type="string" isCombinedKey="true"/>
<attribute name="extension" type="string" isCombinedKey="true"/>
<attribute name="type" type="string"/>
<attribute name="warningLevel" type="int"/>
<collection addElement="providerOption">
<attribute name="name" type="string" isUniqueKey="true"/>
<attribute name="value" type="string"/>
</collection>
</collection>
</element>
</sectionSchema>

Resources