background preloader

.NET

Facebook Twitter

Elmah - Error Logging Modules and Handlers for ASP.NET. ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.

Once ELMAH has been dropped into a running web application and configured appropriately, you get the following facilities without changing a single line of your code: Logging of nearly all unhandled exceptions. A web page to remotely view the entire log of recoded exceptions. A web page to remotely view the full details of any one logged exception, including colored stack traces. In many cases, you can review the original yellow screen of death that ASP.NET generated for a given exception, even with customErrors mode turned off. ELMAH 1.2 Service Pack (SP) 2 now available for download. More Features Log errors to several back-end storages: Supports ASP.NET 1.x, 2.0 and later versions.

ELMAH in Action. Dan Rigsby » How to throttle a Wcf service, help prevent DoS attacks, and maintain Wcf scalability. What can you do to prevent denial of service (DoS) attacks on your Wcf services? A DoS attack occurs when a flood of client requests come into a service and prevent legitimate requests from being made or slow down intended processing. At the same time, you need to be careful not to stranglehold legitimate requests and activity. Throttling Throttling is one mechanism that can be used to help mitigate the load from a DoS attack. Throttling allows you to "smooth" out the load on the server. Wcf handles throttling through the ServiceThrottlingBehavior class. Or through the app.config: There are 3 properties supported on the ServiceThrottlingBehavior: MaxConcurrentCalls (default = 16) [Per-message] The maximum number of messages that can actively be processed.

"The open operation did not complete within the allotted timeout of 00:00:59.9989999. You could set all the these values to Int32.Max. Recommendations: Quotas MaxDepth (default = 32) The maximum nested node depth. Creating high performance WCF services - Scott Weinstein on .Net. I had a WCF service where I wanted to be able to support over a hundred concurrent users, and while most of the service methods had small payloads which returned quickly, the startup sequence needed to pull down 200,000 records. The out of the box WCF service had no ability to support this scenario, but with some effort I was able to squeeze orders of magnitude performance increases out of the service and hit the performance goal. Initially performance was abysmal and there was talk of ditching WCF entirely ( and as the one pushing WCF technology on the project this didn't seem like a career enhancing change ) Here's how performance was optimized.

These are listed in the order they were implemented. Use NetTCP binding This helps both throughput and the time it takes to open and close connectionsUse DataContract Serializer instead of XMLSerializerI started out using DataTables - POCO objects via Linq2Sql yielded a 6x increaseslow: [OperationContract] MyDataTable GetData(...) CodePlex - Open Source Project Hosting. Convert C# to VB.NET - A free code conversion tool.

Json.NET.

Encryption

GetType and TypeOf confusion - Joacim's view on stuff. Both VB and C# have an operator called TypeOf (or typeof in C#) but they perform two completely different things. In VB there are also two kind of GetType() calls, the object.GetType() method which is part of the .Net framework and the VB language specific GetType() operator. Are you confused yet? Don’t worry, in this article I will try to explain the difference between these operators and the object.GetType() method. The TypeOf, typeof, GetType operators The VB TypeOf operator is used together with the Is keyword and is used for checking if an object is of a particular type. result = TypeOf x Is String If “x” above is a string then “result” would be True otherwise it is set to False.

Result = x is string; The typeof operator in C# on the other hand returns an instance of the System.Type class containing type declarations of the type you pass to it. Type t = typeof(string); The VB equivalent of the C# typeof operator is the GetType operator. Dim t As Type = GetType(String) Have fun!

Project Hosting.