New Relic does not monitor my C# console application - configuration

I follow these steps to install and configure New Relic for my non-IIS .NET application: https://docs.newrelic.com/docs/agents/net-agent/instrumentation/instrumenting-non-iis-apps
Enable the agent in the application's config file. In the config file, add a new appSetting with a key named NewRelic.AgentEnabled and a value of true.
I have all done but couldn't monitor my app on New Relic.
Have any offer?

If you follow correctly all the steps newrelic has to work, make sure the following:
You activate the options in the red rectangles when you installed
(see this link http://i.stack.imgur.com/AroqR.jpg)
Create or modify app.config file of your application adding this (appSettings tag):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="NewRelic.AgentEnabled" value="true" />
<add key = "NewRelic.AppName" value="MYAPPLICATIONNAME" />
</appSettings>
In the new relic config file, make sure you are renaming the "instrumentation" tag with the name you use in app.config (NewRelic.AppName value)
<instrumentation>
<applications>
<application name="MYAPPLICATIONNAME" />
</applications>
</instrumentation>
Restart you application (or your windows session lol)
I did this a lot of time and works for me.

Related

Different appsettings.json configuration for the same dotnet core program on the same server

I have dotnet core program that I would like to install 2 different configurations(development and test) of on the same server but using different appsettings.json files.
One needs to use appsettings.Development.json
The other must use appsettings.Test.json
Normally, appsettings.json are selected by looking up the value of the System variable called, DOTNET_ENVIRONMENT on the server.
Is there anyone who knows a method to deploy the same piece of software on the same server and there use different appsettings.json files?
There is else way to define the ASPNETCORE_ENVIRONMENT, in the we.config file.
If both exists (enviroment variable and in the web.config - the one in the web.config win because it more specific)
<configuration>
<system.webServer>
<aspNetCore processPath="D:\Dev\Example.exe" arguments="" stdoutLogEnabled="false" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_HTTPS_PORT" value="443" />
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
<environmentVariable name="COMPLUS_ForceENC" value="1" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
To change the ASPNETCORE_ENVIRONMENT environmentVariable of the web.config while release there are some options, let me know if you want and I will post them.

WP8 updated to Googles API to v3 reference assemblie error

Hi I have updated my project references to include the latest Goolges.apis.Youtube.v3 library which I downloaded from NuGet using the console manager in Visual Studio 2013. Now when I compile the project I get the following error:
Error 1 Cannot resolve reference assemblies. Please check the reference assemblies. Cannot resolve dependency to assembly 'Google.Apis, Version=1.9.0.23042, Culture=neutral, PublicKeyToken=null' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.
I have tried right clicking references > manage nuget packages and removing Goolges.apis.Youtube.v3 which also removes some dependencies etc.
I have done a clean bulild between uni-stalls and aslo deleted the following items from the packages.config file in the project directory:
<package id="Google.Apis" version="1.9.0" targetFramework="wp80" />
<package id="Google.Apis.Auth" version="1.9.0" targetFramework="wp80" />
<package id="Google.Apis.Core" version="1.9.0" targetFramework="wp80" />
<package id="Google.Apis.YouTube.v3" version="1.9.0.1280" targetFramework="wp80" />
As they still resided there after the unisatll..?
Any help with is much appreciated?
Thanks

EF6 and MySQL Generate Database from Model

I've tried every solution I've found on the web with no success. I continually get the error:
Running transformation: System.InvalidOperationException: The SSDL generated by the activity
called 'CsdlToSsdlAndMslActivity' is not valid and has the following errors:
No Entity Framework provider found for the ADO.NET provider with invariant name
'MySql.Data.MySqlClient'. Make sure the provider is registered in the 'entityFramework'
section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for
more information.
I have an empty Console project and a very basic model to test this with. Through the NuGet Package Console I'd executed: Install-Package MySQL.Data.Entities which installed EF6, MySQL.Data and MySQL.Data.Entities and hooked up all the references and copied the relevant DLL's into the bin/Debug folder.
I wired up the provider in the following (entire config file listed)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"></provider>
</providers>
</entityFramework>
</configuration>
As far as I can tell I have the provider registered. I have the latest MySQL connector updated as well. Where am I going wrong?
To support full functionality EF Designer requires 3 things:
EF runtime provider (you seem to have it)
DDEX provider for your database - DDEX is the way VS abstracts databases and as a result can talk to any database. Note that this is not something that is EF specific but EF Designer relies on it (again you seem to have it otherwise you would not be able to select MySQL connection)
Additional components (T4 templates/Workflow activities) required to support Model First flow - these are EF specific but typically installed as part of the DDEX provider - you seem to be missing this or you did not select the T4 template/workflow specific to your provider (open the edmx file and go to the properties window there are two options there that are interesting from DDL generation perspective - the "Database Generation Workflow" and the "DDL Generation Template". Click the dropdowns to see if you can select something that is MySQL specific)
Because you don't seem to have or use the workflow/T4 for MySQL (note I don't know if this is because you did not select the correct T4/workflow (see above) or MySQL DDEX does not support this or the installation is for whatever reason broken) EF Designer is using the default workflow which is for Sql Server. The default workflow relies on being able to find EF providers (for SqlServer and SqlServerCe) in the default path but the provider for MySQL is not there - hence the error. Note that the workflow and T4 templates for creating DDL are provider specific so even if you copied the MySQL provider to the default path it would not really work - you would get a peculiar result of SQL Server specific SQL Script using MySQL types.
We have a bug on improving this a little bit by providing a better guidance instead of just invoking the default DDL generation which we know will not work. You can also find some details in this bug.
I would suggest checking if MySQL components you are using do support Model First. An alternative would be just to move to Code First which only requires the EF runtime provider you already have to generate the DDL.
The other answer already kind of says this, but it's buried in his long post.
Notice that the error message refers to SSDLToSQL10.tt. You don't want that .tt file, you want the MySQL one. In the EF designer properties window, find the DDL Generation Template property and change it from SSDLToSQL10.tt to SSDLToMySQL.tt.

Issue in .CSHTML pages while loading the blog as virtual directory in iis6

Anyone Please Help,
I believe this doubt is pretty out dated, but if any expert could nail it easily for me.
We have created an application using umbraco CMS and created a blog using BlogEngine 2.8 in Web Matrix, everything works awesomely fine in localhost.
When i moved complete website and blog to the staging server in iis6 am facing issues while i run my blog it loads fine, but while i click on Dashboard it throws me the below error.
Exception type: InvalidOperationException
Exception message: Could not locate Razor Host Factory type: umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines
I have already done the below:
Since i setup the blog in virtual directory, i commented out the inherited child application's handlers.
Am using the same application pool for both application and virtual directory.
Also, I added and removed the below in between in Blog web.config
<security>
<requestFiltering>
<fileExtensions>
<remove fileExtension=".cshtml" />
<add fileExtension=".cshtml" allowed="true" />
</fileExtensions>
</requestFiltering>
Added and removed the below key in app settings in Blog web.config
uncommented the below from blog web.config
<!-- you may need it if you have issuew with razor/ajax in admin cshtml pages -->
<buildProviders>
<add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/>
</buildProviders>
Please anyone of you guys let me know how to fix this.

How can we configure database connection from JBOSS?

Can we configure database connection from JBOSS? If it is possible, than is there any configuration file in JBOSS to configure database connection from JBOSS?
You need two things:
Make the JDBC driver available to your Applications Server
Write a Data Source configuration
For #1, you can download the JAR containing JDBC driver and put it in the following directory:
$JBOSS_HOME/server/default/lib
Assuming that $JBOSS_HOME points to your JBoss installation, and you are using default installation.
For #2, you will find a lot of examples here:
$JBOSS_HOME/docs/examples/jca
There are examples for most of database products around. Here's PostgreSQL's:
<datasources>
<local-tx-datasource>
<jndi-name>PostgresDS</jndi-name>
<connection-url>jdbc:postgresql://[servername]:[port]/[database name]</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>x</user-name>
<password>y</password>
<!-- sql to call when connection is created. Can be anything, select 1 is valid for PostgreSQL
<new-connection-sql>select 1</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool. Can be anything, select 1 is valid for PostgreSQL
<check-valid-connection-sql>select 1</check-valid-connection-sql>
-->
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>PostgreSQL 7.2</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
Well, this looks like a good guide for configuring a datasource for JBoss.
A JDBC driver is needed for your database (a jar file, refer to your db's documentation) and afterwards, configuration. You should be able to configure it using JBoss admin console.
After your datasource is configured, you can use JNDI or some other mechanism for obtaining it in your application. Then you use JDBC for actually interacting with your database. Another popular alternative is using JPA since JBoss already has Hibernate built in.
Follow the following steps:
Add my sql connector jar in main folder (eg. \modules\system\layers\base\com\mysql\main).
Add a module.xml file to this folder consisting of the following config:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.17-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Now in stanalone.xml file add mysql driver under drivers tag as following:
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
start the jboss server from command prompt by going to location of the jboss/bin folder and executing standalone.bat
Now in a browser, open localhost:8080, click on administration console and under create a datasource click datasource. Then click on add.
Add the following details:
Name: MysqlDS5
JNDI Name : java:/mysql
click next and under "detected driver" select mysql.
click next
Connection url : jdbc:mysql://localhost:3306/sampledb
UserName:****
Password:****
click done, select the MysqlDS and click on enable.
click on test connection and it will successfully connect.