Why is nLog writing logs hwen exe is run and nothing when run in nUnit - console-application

I am running an integration test and would like to see the logs.
Now if i execute the console app .net 4.8 I get an expected file output.
If i run the nUnit integration tests not even the files are created?
The nLog.config is always deployed to the testing folder and is present.
Is this by design? how can I fix/turn on logging during testing for a console app
<target name="filelogTest" type="File"
fileName="${basedir}/log/Test${longdate:cached=true}.log"
layout="${date}: Session [${scopeproperty:item=SessionContext}] Level [${level}], message :[${message}],"
keepFileOpen="true"
openFileCacheTimeout="5"
concurrentWrites="true"> </target>
<rules>
<logger name="*" minlevel="Trace" writeTo="filelogTest" />
</rules>

The answer was simple the relative path is different for exe and unit test and I was looking at the wrong place.

Related

Econnect Warning: Distributed Transaction was used

We just moved one of our apps which is a .net windows service to a new 2016 server in a different domain than the Microsoft GP database server is in.
We are using EConnect 14 (GP 2015).
We are getting 1000's of these warning in the application event log, which causes a problem because we use System Center and when it sees all those warnings it is spiking the CPU to process them. They don't stop until we restart our windows service.
Here is the warning.
Distributed Transaction was used
This could be caused by new connection strings used within each xml document, but reusing the base transaction scope.
Configuration Setting 'ReuseBaseTransaction' is by default FALSE. Remove this configuration setting, or set it to FALSE if this was not the expected behavior.
i've tried adding this into the econnect service config and my apps config, tried setting it to false, tried true as well and the warning persists.
<appSettings>
<add key="ReuseBaseTransaction" value="false"/>
</appSettings>
We are using the econnect windows service, we are not bypassing the proxy and going directly to the stored procs.
Do you have any idea how to prevent this warning. I really don't care if the transaction is distributed or not. I found this related article but it offers no solution.
https://dynamicsgpland.blogspot.com/2010/09/econnect-2010-fills-event-log-with.html
as well as this one.
https://community.dynamics.com/gp/b/gpdynland/archive/2010/09/23/econnect-2010-fills-event-log-with-warning-34-distributed-transaction-was-used-34
-Randy
There is a flag in the eConnect API that you can configure in your app.config in order to disable the logging of these promotions.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="LogDtcPromotions" value="false"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

ASP.NET Core 2.0 how to increase IIS Express request timeout in launchSettings.json

I have an ASP.NET Core 2.0 API that I am trying to debug using VS2017 / IIS Express on my local Win10 dev computer and I am running into an issue with IIS Express in that it is hitting the response timeout default of 2 minutes before my process can complete in my API, thus returning a 502.3 - Bad Gateway message.
I process continues to run in my API and completes after 3 minutes and 50 seconds. So, I need to increase the request timeout for IIS Express.
Most of the examples I have found on the web talk about using the web.config, for example;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="00:20:00" processPath="dotnet" arguments=".\MyAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
... but from what I understand, An ASP.NET Core 2.0 API running on the local IIS Express doesn't uses a web.config from my project bt rather, it relies on launchSettings.json in the project. However, I have not been able to find anything on the web that talks about launchSettings having any settings values for increasing default timeouts.
Just to confirm, I tried putting a web.config file, like what I listed above, in my project's wwwroot folder, but it made no difference. This worked on my deployed solution in Azure (see related Stack Overflow post) but doesn't in IIS Express on my local dev.
This seems like it should be a simple task but so far I have not had any luck finding a solution.
Any ideas?
EDIT 5/27/18 - SOLUTION
IIS Express with ASP.NET Core 2.0 uses a file similar to a web.config called applicationhost.config, which is located in the project root/.vs/config folder. This file has a
<configuration><Location> ... <location</configuration>
section similar to what I have listed below. This section has the
<aspNetCore ... />
node where I was able to apply the requestTimeout value. By setting that, my dev system was able to get past the default 2 minute timeout.
<location path="MyAPI">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<httpCompression>
<dynamicCompression>
<add mimeType="text/event-stream" enabled="false" />
</dynamicCompression>
</httpCompression>
<aspNetCore requestTimeout="00:20:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="false" />
</system.webServer>
</location>
You misunderstood the concepts.
launchSettings.json is only used by Visual Studio to determine how to run your web project. (More info in my blog post)
IIS Express still relies on web.config to read the settings, as that's the only file it understands.

Does XL Deploy support Fluent Migrator?

I want to use Fluent Migrator for database migrations for my .net project. Anyone has success stories of Fluent Migrator integrated with XL Deploy for database deployment?
Regards,
Pandian.
This can be done through customizations Using XLDeploy Rules
You need first to have your migration script which will be have steps needed to run for migrating your database.
Then you need to add or modify the following files in the ext folder of the XL Deploy server:
1- synthetic.xml, which will contain the configuration item (CI) types that are defined .. Those will be for example contain parameters you need to pass to your script like below,
<type type="MigrateDB.DeployedScripts" extends="udm.BaseDeployedArtifact" deployable-type="MigrateDB.Scripts" container-type="MigrateDB.Runner">
<property name="username"
kind="string"
required="false"
description="The user to use to connect to the database."/>
<property name="password"
kind="string"
required="false"
password="true"
description="The password to use to connect to the database."/>
<property name="schemas"
kind="set_of_string"
required="true"
description="list of schemas."/>
</type>
2- xl-rules.xml, which will contain the rules that are defined
First you define when you need this rule to run like while you are doing initial deployment or update through setting condition like below
<conditions>
<type>MigrateDB.DeployedScripts</type>
<operation>CREATE</operation>
<operation>MODIFY</operation>
</conditions>
Then you can define location of your migration script which will be relative to ext directory like below,
<jython>
<description expression="true">"Run migration"</description>
<order>50</order>
<script-path>MigratDB/run-migration.py</script-path>
</jython>
Make sure to restart XLDeploy service after applying those changes .. You may have a look how this plugin xld-flyway-plugin is created .. you can also try to discover and use it by placing it's jar under plugins directory.

Azure flask <handler> scriptProcessor could not be found in <fastCGI> application configuration

I am trying to deploy Python Flask application in the Azure web app. I had create web app(Flask) and published my code. After publish, I am getting below error from the site.
The page cannot be displayed because an internal server error has
occurred.
When check the Log, i could see the below error.
But this was happening only in my subscription(free subscription got with MSDN). But working fine in the Organisation subscription.
The <fastCGI> settings must be in the applicationHost.config file (in the system.webServer section) of IIS. Just putting it into web.config does not work (confirmed by testing it on a local IIS, not in Azure). An example configuration may look like this:
<fastCgi>
<application
fullPath="D:\home\Python27\python.exe"
arguments="D:\home\Python27\wfastcgi.py"
maxInstances="16"
idleTimeout="21600"
instanceMaxRequests="10000000"
signalBeforeTerminateSeconds="60"
xdt:Transform="InsertIfMissing"
xdt:Locator="Match(fullPath)">
<environmentVariables>
<environmentVariable name="PYTHONHOME" value="D:\home\Python27" />
</environmentVariables>
</application>
</fastCgi>
You may want to adjust this configuration.
This should solve it for a local IIS where you can edit applicationHost.config. I'm not sure about Azure, but maybe you can find some hints here: https://github.com/Azure/azure-python-siteextensions/issues/2.

Webservice .Net 4.0 publishing problems in IIS7

I cant get my Webservice published, it should be simple:
I create the app in the IIS,
place it as a 4.0 Classic .Net
I publish it from .Net Solution within VS2012 Right click and publish
on the Webservice project.
The files are placed and it should show by itself on the browser on the URL of the server specified.
But I stumbled upon the following problems:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
So I've looked for It and found this two options:
Option 1:
http://www.banmanpro.com/support2/Requested_Content_Appears_to_be_Script.asp
This one says I should go to Integrated, instead of Classic App Pool. but it's like if I changed a problem for another because now it says:
HTTP Error 500.21 - Internal Server Error
Handler "WebServiceHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
When I go to the web config see what is this error talking about I see no handler tag!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings />
<connectionStrings />
<system.web>
<compilation targetFramework="4.0" />
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
</system.web>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
</configuration>
Should I add one? If so, how?
Option 2:
Script not served by static file handler on IIS7.5
Basically it says I shoud do a aspnet_regiis -i, but when I try
going to %windir%\Microsoft.NET\Framework\v4.0.30319
Even when the folder exists, There is no aspnet_regiis!!
I've only found the aspnet_regiis on the 2.0 Fwk =(
Is that normal?
The handler tag wasn't the answer, however, both options drove me to look for the missing aspnet_regiis of fwk 4.
There was no aspnet_regiis because the full fwk 4.0 wasn't actually installed on a first place.
I had installed on the server the Framework 4 Client Profile and the debugger, which isn't the full version. From now on, whenever I think I have fwk 4 installed, I'll check twice.
After installing it, on Framework 4.0 Classic Pipeline Mode (instead of Integrated) made it work just fine.
But Attention!
After installing the framework, IIS will change the default pipeline to 4.0, that means, if you had ongoing a web(site/service) on 2.0 it will automatically stop working. (It happened to me)