I am using NLog for logging in my asp.net 4.5 website. I have used NLog 4.0. Now I need to use session variables in my logs. So i tries to use AspNetSession layout renderer. This layout renderer is included in Nlog.Web. I have added this dll and also under the extensions tag in NLog config file. But it gives the following error:
ArgumentException: LayoutRenderer cannot be found: 'aspnet-session'
I have also added NLog.extended dll and also under the extensions tag in NLog config file. But it also didn't help.
Please let me know what should i do.
You need to install NLog.Web assembly from NuGet by using the following command.
Install-Package NLog.Web
Related
I'm trying to do something with .NET core in VS2017 RC, but I noticed the packages.config is missing, because they default in defining dependency in the project file.
However my configuration look like this:
so apparently it should use the file. Apparently it does not honour that configuration.
Furthermore,
Is there some reason we should prefer the dependency in the project file anyway?
In previous versions of .net the csproj contained an assembly reference to a DLL that was stored inside a package. However that was treated seperately, from the packages.config which declared the packages to restore into the packages directory.
In dotnet core, packages are declared inside of the csproj file, as "PackageReference" The overall idea of a packages.config does not exist in dotnet core, which is why visual studio is not trying to create one for you. If you were using the old project system, you will find a packages.config is created for you.
That setting you set won't be honored by .NET Core projects.
.NET Core always uses the package reference. So say goodbye to package.config.
Added to project.json file for logging:
"Microsoft.Framework.Logging.NLog": "1.0.0-beta1"
The Framework.Logging.NLog depends internally upon NLog, which I tried installing via Nuget, project.json, Package console. It doesn't help.
Also wasn't able to find a way to configure NLog logging and a tutorial/guide to place the config sections of NLog.
NLog does not ship for CoreClr hence you need to define the dependency under aspnet50. Do look at the sample https://github.com/aspnet/Logging/blob/dev/samples/SampleApp/project.json
I read about Web API having its own TraceWriter implementation with 2012.2, for example here, among other sources.
I am now using VS2013 with .NET 4.5.1 and the EnableSystemDiagnosticsTracing is nowhere to be found. It's meant to be defined in the HttpConfigurationTracingExtensions class which resides in the System.Web.Http.Tracing.dll. However, this assembly is nowhere to be found - not in list of assemblies in the Add Reference dialog, not in GAC.
Where is this assembly supposed to come from? Docs say it's part of .NET Framework 4, which I have installed. Also installed the ASP.NET Web API 2 Tracing 5.0.0 NuGet package. Is there some update? Should I re-install .NET Framework?
I know it's not a big deal to implement ITraceWriter myself but it bothers me not to know what happened with the built-in implementation.
Just install needed NuGet Package
Install-Package Microsoft.AspNet.WebApi.Tracing -Version 5.0.0
It's a little bit strange, but it is the right package
http://www.nuget.org/packages/microsoft.aspnet.webapi.tracing
If you installed the Tracing 5.0.0 NuGet package, it should be correctly included in your project. The moment it is installed, I believe a separate text file should open in VS showing the code you should include in your WebApiConfig.cs file.
I haven't created a Web API 2 project from scratch (only upgraded from pre-5.0 to 5.0 projects), but this is the code that should reside in your WebApiConfig.cs file:
// To disable tracing in your application, please comment out or remove the following line of code
// For more information, refer to: http://www.asp.net/web-api
config.EnableSystemDiagnosticsTracing();
And that should be it, if the package is installed correctly, tracing should now be used in your project.
I'm trying to create a basic ASP.net f# application and when I'm trying to reference the Youtube .net API I'm getting a "The namespace or module 'Google' is not defined" in my code behind file.
I've used the default ASP web forms template in Visual Studio, removed all of the contents, then loaded in the examples from Expert F#, Chapter 14. The default examples run fine, the problem only occurs when loading the Google API. The API works fine when I load it through an f# console application.
The first few lines behind file looks like:
#light
namespace MyASPApp
open System
open System.Web
open System.Web.UI
open System.Web.UI.WebControls
open Google.YouTube
Can anyone think of a resolution to the problem, or anything I could check to understand why its not picking up the Google API?
The Google assembly may require that the application not use the Client Profile, which is the default in VS 2010. Try editing the project settings and changing the Target Framework property.
Did you check which version of .NET Framework that google assembly is built for? If it .NET 3.5 or .NET 4.0? If that is not set properly too this will occur.
-Fahad
We have a VS2005 solution including two websites.
We converted the solution to VS2010 and changed all settings in IIS and in the config file to use .NET framework 4.0.
We removed the old assembly references in web.config file and added references to the new versions of the assemblies and here the problem comes: when we add a refererence to System.Design assembly in the web.config file the website does not build. The build via msbuild.exe results in the following error:
ASPNETCOMPILER : error ASPPARSE: Object reference not set to an instance of an object. [d:\DevSites\SolutionFolder\WebSite.metaproj]
Does anyone have any suggestions why this happens? Thanks.
We've solved it - after the removal of the browser definition file the problem disappeared