Server-Side Asynchronous Methods for ASP.NET and WinFX - The Code Project - C# WebServices
This article describes how to make asychronous calls to a web service. This is useful when the web service has to perform some task that takes a while to complete before returning the result to the client. By making an asynchronous call, the thread of the calling process can go back into the pool and be useful for other purposes while waiting for the response.
Well.. here it is... my BLOG! Started out being mostly used for dropping bookmarks - links to good sites relating to my current interests. Now even with some code samples and comments about interesting pages.
2006-03-28
2006-03-27
ITavisen.no | Nettet på: en helt ny måte
This article in Norwegian gives a few tips on starting out with Ajax (Asyncronous Javascript and XML).
This article in Norwegian gives a few tips on starting out with Ajax (Asyncronous Javascript and XML).
2006-03-24
WebService Connection problems
Quote from a newsgroup (slightly modified):
"If a website (or a webservice) calls a webservice on the same server, then there is no limit on outgoing connections on the Framework. Due to this, the number of outgoing connections to the ASMX page will be huge, and for each connect that takes place, one wildcard TCP port gets used. Since there is a limit of 5000 wildcard TCP ports on the OS, pretty soon, after 5000 or so socket.Connects(), they will start failing with "unable to connect exceptions".
If the authentication is set to NTLM, then you will run into this problem sooner. This is because NTLM uses one extra connection, and after each successful request, that connection is torn down. If you are running into this, try setting "UnsafeAuthenticatedConnectionSharing=true" on the underlying HttpWebRequest
of the client."
A web service client has in .NET by default a limit of 2 connections. You can adjust this limit by putting the following into the web.config file of the client web (not sure about winforms clients, but probably you can put the same into the config file here as well):
Quote from a newsgroup (slightly modified):
"If a website (or a webservice) calls a webservice on the same server, then there is no limit on outgoing connections on the Framework. Due to this, the number of outgoing connections to the ASMX page will be huge, and for each connect that takes place, one wildcard TCP port gets used. Since there is a limit of 5000 wildcard TCP ports on the OS, pretty soon, after 5000 or so socket.Connects(), they will start failing with "unable to connect exceptions".
If the authentication is set to NTLM, then you will run into this problem sooner. This is because NTLM uses one extra connection, and after each successful request, that connection is torn down. If you are running into this, try setting "UnsafeAuthenticatedConnectionSharing=true" on the underlying HttpWebRequest
of the client."
A web service client has in .NET by default a limit of 2 connections. You can adjust this limit by putting the following into the web.config file of the client web (not sure about winforms clients, but probably you can put the same into the config file here as well):
<system.net>
<connectionmanagement>
<add maxconnection="40" address="*">
</connectionmanagement>
</system.net>
Solving "The underlying connection was closed: An unexpected error occurred on a send." (Webservices)
Jan Thielen (MVP) gives a solution to the problem of sporadic errors of type "The underlying connection was closed".
In essence, you need to add the following code to your Webreference's Reference.cs file:
Jan Thielen (MVP) gives a solution to the problem of sporadic errors of type "The underlying connection was closed".
In essence, you need to add the following code to your Webreference's Reference.cs file:
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.HttpWebRequest webRequest =
(System.Net.HttpWebRequest) base.GetWebRequest(uri);
webRequest.KeepAlive = false; return webRequest;
}
2006-03-20
Caring for your introvert
This article explains why introverts are the way they are, so that maybe extroverts can understand them better.
This article explains why introverts are the way they are, so that maybe extroverts can understand them better.
2006-03-06
Code Generation with Codesmith
Codesmith is an excellent tool for generating general code, like for instance cargos. You don't always have to type all the boring code. Codesmith can do some of the tedious work!
Codesmith is an excellent tool for generating general code, like for instance cargos. You don't always have to type all the boring code. Codesmith can do some of the tedious work!
Sam Gentile : No More VSS, Its Subversion
Visual Sourcesafe or as it is now known Team System is not so stable it seems. This to a degree that makes Same Gentile refer to it under the name "Unsafe" (as opposed to its real name "SourceSafe"). His team is now going for the open-source freeware Subversion source code versioning system.
Visual Sourcesafe or as it is now known Team System is not so stable it seems. This to a degree that makes Same Gentile refer to it under the name "Unsafe" (as opposed to its real name "SourceSafe"). His team is now going for the open-source freeware Subversion source code versioning system.
2006-03-03
List of .NET 2.0 and C# 2.0 new features - The Code Project - Book Chapters
Very useful list of new features in .NET 2.0 and C" 2.0.
Very useful list of new features in .NET 2.0 and C" 2.0.
Ajax (programming) - Wikipedia, the free encyclopedia
Ajax is a hot buzzword these days (Asynchronous Javascript And Xml). It is a technique for making web GUIs that look more like windows forms applications (less flicker, less postback) because more operations are performed client-side.
Ajax is a hot buzzword these days (Asynchronous Javascript And Xml). It is a technique for making web GUIs that look more like windows forms applications (less flicker, less postback) because more operations are performed client-side.
Bamboo.Prevalence - a .NET object prevalence engine
An alternate to storing business objects in a database. Now that 64 bit CPU's are coming more and more, and they can handle much more RAM, this is probably something for now and the future. 3000 times faster than mySQL!
This is how it works:
1) All business objects are stored in RAM. 2) Once in a while a snapshot of all business objects is serialised to disk. 3) All operations on objects are stored in a log.
So what if the server crashes?
1) Restore the last snapshot.
2) Replay all actions from log.
A lot like the MS SQL Server backup / Transaction Log bacup.
An alternate to storing business objects in a database. Now that 64 bit CPU's are coming more and more, and they can handle much more RAM, this is probably something for now and the future. 3000 times faster than mySQL!
This is how it works:
1) All business objects are stored in RAM. 2) Once in a while a snapshot of all business objects is serialised to disk. 3) All operations on objects are stored in a log.
So what if the server crashes?
1) Restore the last snapshot.
2) Replay all actions from log.
A lot like the MS SQL Server backup / Transaction Log bacup.
2006-02-16
Are You in the Know? Find Out What's New with Code Access Security in the .NET Framework 2.0 -- MSDN Magazine, November 2005
I've got to read this some time soon.
I've got to read this some time soon.
It's Me, and Here's My Proof: Why Identity and Authentication Must Remain Distinct -- TechNet Column - Security Management - February 2006
Why you can't rely on just biometrics for authentication. Your fingerprint tells who you are (your ID). So what if someone chopped off your finger?
Why you can't rely on just biometrics for authentication. Your fingerprint tells who you are (your ID). So what if someone chopped off your finger?
2006-02-15
Request.ServerVariables("HTTP_REFERER") - What is going on?
NIS by default blocks the header "HTTP_REFERER" to be sent from the browser to the server. If your web application is depending on this servervariable, and your clients are using NIS, then do the following:
NIS:
- Privacy control - configure
- Advanced button
- Global settings tab
- "Information about visited sites"
If blocked (this appears to be the default) then HTTP-REFERER is wiped out. Change this option to allow the header to be sent.
NIS by default blocks the header "HTTP_REFERER" to be sent from the browser to the server. If your web application is depending on this servervariable, and your clients are using NIS, then do the following:
NIS:
- Privacy control - configure
- Advanced button
- Global settings tab
- "Information about visited sites"
If blocked (this appears to be the default) then HTTP-REFERER is wiped out. Change this option to allow the header to be sent.
2006-02-10
.NET Tools: Ten Must-Have Tools Every Developer Should Download Now -- MSDN Magazine, July 2004
You cannot expect to build a first-class application unless you use the best available tools. Besides well-known tools such as Visual Studio® .NET, there are a multitude of small, lesser-known tools available from the .NET community. In this article, James Avery describes some of the best free tools available today that target .NET development.
You cannot expect to build a first-class application unless you use the best available tools. Besides well-known tools such as Visual Studio® .NET, there are a multitude of small, lesser-known tools available from the .NET community. In this article, James Avery describes some of the best free tools available today that target .NET development.
2006-02-06
FuzzyEnumParse
This function takes an Enum type and a text representing the value of the enum, and if the Enum has a field with a name contained in the text (enumText), then it returns that value.
For use when for instance the database field to parse from has been extended somewhat... Modify to suit your needs!
This function takes an Enum type and a text representing the value of the enum, and if the Enum has a field with a name contained in the text (enumText), then it returns that value.
For use when for instance the database field to parse from has been extended somewhat... Modify to suit your needs!
private object FuzzyEnumParse(System.Type type, string enumText)
{
System.Reflection.FieldInfo[] fis = type.GetFields();
foreach(System.Reflection.FieldInfo fi in fis)
{
if(fi.Name!="value__")
{
object obj=fi.GetValue(null);
if(enumText.IndexOf(obj.ToString())>-1)
{
return obj;
}
}
}
return null;
}
2006-02-01
Serialising doesn't work for read-only properties in webservices
I have been puzzled by the behavior of my webservice. I have a couple of properties in an object that is sent as a parameter to the webservice. Since these properties are not assigned directly by any code, I didn't implement a "set" method for the properies. (As it turns out: Bad mistake!)
What happened was that the values were set in the client to "true", but when the object arrived inside the webservice, the values were suddenly "false".
It turns out, if you don't implement both "get" and "set" for a property, it will not be serialised.
I have been puzzled by the behavior of my webservice. I have a couple of properties in an object that is sent as a parameter to the webservice. Since these properties are not assigned directly by any code, I didn't implement a "set" method for the properies. (As it turns out: Bad mistake!)
What happened was that the values were set in the client to "true", but when the object arrived inside the webservice, the values were suddenly "false".
It turns out, if you don't implement both "get" and "set" for a property, it will not be serialised.
2006-01-19
#2413 : Why do I get non-database-related 80004005 errors?: "Request object, ASP 0104
Operation not allowed"
I got this error at a customer's after they upgraded their web servers to Windows Server 2003. The error appears when trying to upload files through the web. Turns out there is a setting in the metabase.xml file (located in the Windows\System32\inetsrv directory) called AspMaxRequestEntityAllowed, that sets the maximum filesize allowed to be uploaded. This is set very low as a default, to only 204 Kb. In Windows 2000 Server you could upload files much larger (well at or above 1 Meg anyway, I believe).
Operation not allowed"
I got this error at a customer's after they upgraded their web servers to Windows Server 2003. The error appears when trying to upload files through the web. Turns out there is a setting in the metabase.xml file (located in the Windows\System32\inetsrv directory) called AspMaxRequestEntityAllowed, that sets the maximum filesize allowed to be uploaded. This is set very low as a default, to only 204 Kb. In Windows 2000 Server you could upload files much larger (well at or above 1 Meg anyway, I believe).
2006-01-18
Best Practices for Microsoft Business Intelligence : Checks used for remoting a query to the server
Describes different reasons why a query can not be executed on the server.
Describes different reasons why a query can not be executed on the server.
2006-01-13
Discworld Quotes
A page with lots of cool quotes from the Discworld series (Terry Prattchett).
My favorite (from "Thief of Time):
If you put a large switch in some cave somewhere, with a sign on it saying 'End-Of-The-World Switch. PLEASE DO NOT TOUCH', the paint wouldn't even have time to dry.
Another good one:
"I'll tell you, the day someone pulls the plug out of the bottom of the universe, the chain will lead all the way to Ankh-Morpork and some bugger saying, 'I just wanted to see what would happen.'"
A page with lots of cool quotes from the Discworld series (Terry Prattchett).
My favorite (from "Thief of Time):
If you put a large switch in some cave somewhere, with a sign on it saying 'End-Of-The-World Switch. PLEASE DO NOT TOUCH', the paint wouldn't even have time to dry.
Another good one:
"I'll tell you, the day someone pulls the plug out of the bottom of the universe, the chain will lead all the way to Ankh-Morpork and some bugger saying, 'I just wanted to see what would happen.'"
OleDbException E_FAIL(0x80004005)
Got this message when I was trying to connect to Analysis Services:
Exception: System.Data.OleDb.OleDbException
Message: No error information available: E_FAIL(0x80004005).
Looks like the most common explanation is that one of the field names in the query is a SQL reserved word, like for instance "Name", "Size" or "Read". If you use bracketed field names this should not be a problem.
Got this message when I was trying to connect to Analysis Services:
Exception: System.Data.OleDb.OleDbException
Message: No error information available: E_FAIL(0x80004005).
Looks like the most common explanation is that one of the field names in the query is a SQL reserved word, like for instance "Name", "Size" or "Read". If you use bracketed field names this should not be a problem.
Subscribe to:
Posts (Atom)