c# - Including log4net into a .net web application built with .net 4.0 -


I have noticed that there are lots of threads on it, there are many threads on the web, but there is no way to stackoverflow Found I have tried three things to solve my problem and all this does not work:

  1. I just tried to get log4net.dll from the log4net zip folder All source code provided is Bin Directory Result : There is no compilation error, But my SmtpAppender does not just send emails to errors.
  2. Therefore, I have found from the web to find out that it can should be related to the version that log4net.dll was compiled. Which is weird, but anyway, I asked to generate a strong key for the assembly who faced an error and said what I did and compile so I leave this project and take log4net.dll and my The projet has been added to the refereces. Result : No compilation error but 1 error when trying to configure it from Global.asax line:

      Protected Zero Application_Start (Object Sender, EventArgs e ) {Log4net .Config.XmlConfigurator.Configure (); }  

    Here is an error: (see # Ref1)

  3. Again, I have found this thread from a certain Ahmed Fouad, according to me , Were looking to work fine. I have done everything I said, but I'm still running in the same error (# Ref1).

Has anybody succeeded in configuring SmtpAppender using C # VSTTnet web inventory using Framework 4.0?

Ref1

Legacy protection rules, while violating the user overriding: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData (System.Runtime.Serialization.SerializationInfo, System.Runtime. Serialization.StreamingContext) '. Override security measures should match security access to the overriding method method

Additional information (review # 1)

something

I have just tried Going other I have completed the converted log4net application with VS.net 2010. SLEN has opened up, a web project looks like my application but in this case, I am able to debug the Log4net library. Here is where it fails:

  // If we could not find any other name, then (representative == faucet) {LogLog.Debug ("DefaultRepositorySelector: Creating Reserves" RepositoryName + "] type [" + repository type + "]"); // Call the ARG constructor for the repository, type here - & gt; Representative = (Illogger repository) catalyst. Createinstance (repository type); & Lt; - here [...]}  

find it !! I have read this post and it just fixes it!

In my first post (question), I have tried that in step 3, it says to change something in AssemblyInfo.cs:

She says: "AssemblyInfo (!; & Amp; NET_4_0NETCF & amp; //) log4net has been strongly named, so it still allows "

  (#) if: CS, partial To be part of this kind of security modified partially dependent callers // [assembly: system. Security Elooparty Trusted Collars] (#) Andif  

This is not good !! You must remove "! NET_4_0" and replace [assembly] with this line:

  [assembly: system. Security. Security Rule (System.Security Security Rule Sleeve1)] Both the SMTPAppender and FileAppender are working fine for me now! 


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -