2007-05-09

The underlying connection was closed: Unable to connect to the remote server.

This error sometimes occurs when consuming webservices through a proxy.

2007-05-04

Load Balancing / EPiServer

Just putting in a few links so I won't loose them:

How to configure a Windows Server 2003 Load Balancing cluster:
Web Farming with the Network Load Balancing Service in Windows Server 2003

EPiServer:
Configuring the Cache in Multi-Server Scenarios
Configuring EPiServer Enterprise Edition

2007-04-12

Script error on ASP.NET 1.1 pages

I got an error message on my aspx web page after one of the latest Windows updates:

Unable to find script library '/aspnet_client/system_web/1_1_4322/WebUIValidation.js'. Try placing this file manually, or reinstall by running 'aspnet_regiis -c'.

After trying to reinstall the script library, and reinstalling aspnet on my web application, I found a solution by simply adding the following code to my aspx file:


<script language="javascript" type="text/javascript" src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>

Update:
After I put in the script-tag above in my "master page", I got an other error on pages not having any validation controls, so I had to put in a hidden dummy validator.

2006-12-04

Changing Locale of the ASPNET account

I have a server that has been installed using default language/locale "en-US".

This becomes a problem with the date format, which is "MM/dd/yyyy" in en-US, while in Norway where I live we use (nb-NO) "dd.MM.yyyy".

There is also a problem with which character to use as a decimal point and which to use as a thousand marker/separator:
Norwegian (nb-NO): decimal point is comma (",") , thousand marker is space. Ex: 2 345,67
US English (en-US): decimal point is dot ("."), thousand marker is comma. Ex: 2,345.67

So I need a way to set the locale that the ASPNET account is using.

There are several ways. You can set this in the web.config file:


<system.web>
<globalization
culture="nb-NO"
uiCulture="nb-NO" />
</system.web>


You can also set it in the users session, by using the Session_Start event handler:


protected void Session_Start(object sender, EventArgs e)
{
this.Session.LCID = 1044;
}


If you want to change the default settings of the ASPNET account (and you have the guts), you could go in and change the settings in the registry.

NB! It may be risky to change settings in the registry. The author of this blog is not responsible for any damage that may be caused by doing so.

Anyway here it is, change the settings under the following key:

HKEY_USERS\S-1-5-20\Control Panel\International

Here you can see settings for number formats, date formats languages etc for the user. I have as of now NOT TESTED THIS, but the key for the ASPNET user should according to a news group be S-1-5-20.

Good luck!

2006-09-27

ADODB serialization

Found a simple but cool way to serialize an ADODB Recordset without converting to DataSet on CodeProject.

2006-08-14

Security Developer Center: Security Tips: Defend Your Code with Top Ten Security Tips Every Developer Must Know

Not sure if I have bookmarked this before. Well, better safe than sorry...

2006-06-22

Build your own cryptographically safe server/client protocol - The Code Project - Internet & Network

Good article that explains quite a bit about how cryptography works.

2006-06-15

Some Cool Tips for .NET - The Code Project - C# Controls

Nice to know info on how to get information about windows and other stuff.

2006-05-30

SQL Server Monitoring in 8 Steps: Lessons From the Field

How to get a quick status of the server while on-site.

2006-05-23

Free JavaScript DHTML Website Menus, Cross Browser Popup Web Menu

Nice, free Javascript menus.
The Soul of a Virtual Machine : Sysprepping a virtual machine

Description of how to sysprep a VPC. Useful stuff.

2006-04-04

HttpSecureCookie, A Way to Encrypt Cookies with ASP.NET 2.0 - The Code Project - ASP.NET

This article describes how to encrypt cookies in .NET 2.0.

2006-04-03

The 46 Best-ever Freeware Utilities

This is a nice page with lots of free software links. Among others, web browsers and antivirus programs.
Auditing Web Site Authentication, Part One

Every web developer should read this. Excellent!
An introduction to Web Service Security using WSE - Part I - The Code Project - C++ Web Services

Some big players as Microsoft and IBM built a group that dealed with the security problem (of Web Services), finally offering several specifications. The most important, and foundation of the others, is Web Service-Security (WS-Security or WSS).

2006-03-29

SSH : Support : Cryptography A-Z

Site with a lot of information on cryptography, and different algorithms.
Visual Studio 2005: Visual Studio 2005 Code Snippets

This is very cool! Nice and free collection of code snippets from Microsoft, ready for pasting into your application source.

2006-03-28

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.

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).

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):

<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:


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.

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!
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.

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.
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.
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.

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.

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.

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!


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.

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).

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.

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.'"
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.
LinkD

A little comparation of the subst command and the LinkD tool. From Craig Andera's blog. Craig also published the now legendary "The last config section handler I'll ever need".

2006-01-02

MSDN TV: Special Holiday Episode III: Connecting People, Programs and Devices Using WinFX: "Special Holiday Episode III: Connecting People, Programs and Devices Using WinFX"

Don Box and Chris Anderson show how to build real applications that leverage the major components in WinFX. With rich UI, robust communication, and workflow control, they build an application that integrates with various devices laying around Don's home to demonstrate how to use WinFX together.

2005-12-15

Setting where calculated members in an OLAP cube should be processed

This post says:
"Because, for example, if your query return less then 1000 members by dimension in your query, all the data is retrieve to the client and the calculated members are calculated on the client side."

So actually the calculated members are by default calculated by the client. This explains why so much CPU is used on the client when there are a lot of calculated members.

To set the location for calculating the members to the server, you can use this parameter in the query string:
Execution Location=3
AutoAccept Sink for Exchange

The AutoAccept Sink for Exchange is a tool for Exchange 2000 that allows resource mailboxes to automatically accept/decline meeting requests based on a combination of factors. These factors include the free/busy status of the resource, whether the requestor is authorized, and many other configurable settings.

2005-12-05

Using the Visual Studio .NET 2003 Debugger with ASP.NET Applications

A very annoing part of VS is debugging. Debugging always hangs after some steps... The article answers some of the questions around debugging. Except my solution still hangs after 3-5 steps...

2005-11-23

Performance Considerations for Making Web Service Calls from ASPX Pages: "At Your Service: Performance Considerations for Making Web Service Calls from ASPX Pages"

This article describes a way of connection to a web service asynchronously that is 8 times faster than the usual synchronous method.

2005-11-21

Simple Mail Transfer Protocol - Wikipedia, the free encyclopedia: "Simple Mail Transfer Protocol"

Shows how to run a manual mail session to test connectivity to a mail server.

2005-11-15

Microsoft SQL Server 2000 Analysis Services Performance Guide

OLAP Performance

Microsoft OLAP Technical Info (articles, whitepapers etc)

As you may have guessed, I am struggling with OLAP performance at the time being. These links provide some information on the subject.

2005-11-10

Rick LaPlante's WebLog

Today I'm meeting Rick LaPlante, who is responsible for the development of Microsofts new Team System (VSTS). Looking forward to it... Hope I can come up with some good questions.

2005-11-09

Mike Woodring's .NET Sample Page

Stumbled across this page... Nice samples.

2005-11-07

Microsoft Next Generation of Certifications: Frequently Asked Questions

Microsoft has changed the certifications. This is a quote from the FAQ:

The new Microsoft certification program is designed to emphasize both the primary technology skill set and the job role of the individual. By focusing on core technical or professional skills, individuals can work toward a certification that meets their needs.

This article describes the changes more in-debth.

2005-10-26

SQL Server 2000 Analysis Services Performance Tuning

Not really one of my areas of competence, but sometimes one have to try to do one's best. The article describes what one might do to improve performance for a data warehouse using MS OLAP / MS Analysis Services.

2005-10-24

Debugging timeouts in a SOA/Web environment

In a Service Oriented Architecture (SOA), having some webservice methods that consume more than a minutes time, timeout can be a problem.

In this scenario there is also a web site acting as the webservice client. The webservice is getting its data from a database.

We know there is a timeout, but where?
a) Could be the connection to the database from the webservice.
b) Could be the connection between the webservice and the webservice client.
c) Could be a browser timeout.
d) Could be a .NET Framework/ASP.NET timeout.

a. The connection to the database
The timeout of a query can be set by a propery on the ADO.NET Command object. The default is 30 seconds.

OleDbCommand dbcmd = new OleDbCommand();
dbcmd.CommandTimeout = 600; //10 minutes should be enough?

b. The connection to the webservice
The timeout of the http connection of a synchronous call to a web service has a default timeout of 100 seconds. This can be set by a property on the web service proxy. You can set it in the constructor of the webservice proxy (remember that this may me overwritten when you update your webservice reference):

public WSMyWebservice() {
this.Credentials = System.Net.CredentialCache.DefaultCredentials;
this.Url = "http://localhost/webservice/WSMyWebservice.asmx";
this.Timeout = 450000; //wait for 7.5 minutes
}

c. The browser timeout
Not covered in this topic.

d. .Net Framework / ASP.NET timeout
There are a few places the timeout can be set in machine.config.
The executionTimeout in the httpRuntime section can be increased. In the .NET Framework versions 1.0 and 1.1, the default is 90:
<httpruntime
maxrequestlength="4096"
usefullyqualifiedredirecturl="false"
minfreethreads="8"
minlocalrequestfreethreads="4"
apprequestqueuelimit="100"
enableversionheader="true"
executiontimeout="90">

In the processModel section there are several timeouts that can be set:
<processmodel
username="machine"
password="AutoGenerate"
timeout="Infinite"
enable="true"
idletimeout="Infinite"
shutdowntimeout="0:00:05"
requestlimit="Infinite"
requestqueuelimit="5000"
restartqueuelimit="10"
memorylimit="60"
webgarden="false"
cpumask="0xffffffff"
loglevel="Errors"
clientconnectedcheck="0:00:05"
comauthenticationlevel="Connect"
comimpersonationlevel="Impersonate"
responsedeadlockinterval="0:03:00"
maxworkerthreads="20"
maxiothreads="20">

The above should show the default settings, although I can't guaratee it. The setting that may be changed to avoid timeout is the responseDeadlockInterval. MSDN states the following about the setting: Specifies the time interval, in standard process model format (hr:min:sec), after which the process is restarted, if the following conditions are met: 1) There are queued requests, and 2) There has not been a response during this interval.

2005-10-19

Logging with log4net stops when aspnet_wp is recycled

A collegue of mine just discovered this problem. The problem was that logging using log4net stops whenever the aspnet_wp process is recycled. The problem is caused by the way log4net and ASP.NET works.

First, whenever the aspnet_wp process has been idle for a while or has used more memory than it should (over 60% default), the process is recycled. This is done in a clever way so users should not be affected. A new aspnet_wp process is started in parallell with the old one, gradually taking over the workload by serving all new requests.

Second, log4net stops logging, even stops trying to log, as soon as it finds out that it can't write to the logfile. Essentially logging is then disabled.

These two facts together is causing logging to stop. When the second aspnet_wp process is started, it will try to log to the same file that the old aspnet_wp process is already logging to. The file will be locked by the old process, so log4net in the new process will detect that the file is not writeable, and disable logging.

2005-10-12

Well... now you can play World of Warcraft even when you sleep. Somebody had made a bot that plays for you and earns experience points even when you sleep... Cheating?

WELCOME TO WEALTHQ.COM!
How big is Visual Studio?

"Visual Studio is over 43 million lines of code, there are over 30 teams working on different pieces, with roughly 700 developers checking-in code to 11 different virtual build labs that are then integrated on a rotating schedule producing over 100 different builds of the product daily."

Mike Stall's .NET Debugging Blog : Size of Visual Studio

2005-09-30

Google-groups : What is VSWebCache?
Explains why there sometimes comes a 401 error and the "could not get files from the server" error, and how to fix the problem by simply deleting the VSWebCache folder.

2005-09-23

Thousands of players in WoW were killed by a virus from Zul Gurub...
Tusenvis drept av spillvirus Spillsonen (norwegian)

Story in English:
http://www.1up.com/do/newsStory?cId=3143959

2005-06-14

Nice Speedometer that also tells you your current IP address:
A BELTRONICA Telecom
Found a solution to a problem I had before, but didn't have the time to fix. Quite logical really that you have to create the EventSource in the registry before you can start logging messages from it.
PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET Application Tries to Write New EventSource in the EventLog

2005-05-03

The content management text editor used by DotNetNuke. Very nice, specially the registered version...
FreeTextBox
This picture series is from a Dan Test. Nice to know what one might have to go through on the test... Shouldn't there be some breaking of planks or even bricks?
Il-Dan Test

2005-04-20

Nice utility for cleaning up HTML.

HTML Tidy Project Page

2005-04-14

2005-04-11

2005-04-06

Free book online about WebServices... good stuff!
Book - Real World XML Web Services

2005-03-17

2005-02-15

Naming Guidelines
Guidelines and naming conventions...

2005-02-09

Microsoft ASP.NET Developer Center
: Security

2005-02-08

What are limitations in Active directory for older clients like NT4 and Windows 98?
Active Directory Client (dsclient) for Win98/NT

2005-01-30

The Code Project - Combo control - ASP.NET
This is a control which will help to generate Tabs , Menus, Slider bars, and Tree views. The controls are created Just in Time dynamically from XML.
The Code Project - The 30 Minute Regex Tutorial - .NET
Good tutorial on regular expressions. With link to an excellent program for trying out different RegEx expressions from Ultrapico.

2005-01-24

DPAPI Tools from Dominic Baier
ASPNET account and network access
Microsoft Certified Professional Magazine Online | Column: The Long and Short of Stub Zones: "Delegation has a disadvantage, though. The NS records created by the Delegation Wizard point at specific name servers by IP address. If an administrator in the child domain changes those IP addresses, or renames the DNS servers, or decommissions a server, this creates a lame delegation. "
DNS

2004-12-08

2004-11-17

Suddenly could not run Enterprise Manager. Located the .MSC file and clicked on it. Still got the same error message:

MMC cannot open the file C:\Program Files\Microsoft SQL
Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC

This may be because the file does not exist, is not an MMC console, or was
created by a leter version of MMC. This may also be because you do not have
sufficient access rights to the file.

Copied the file from another machine. Problem solved.

2004-11-01

2004-10-06

2004-09-22

ViewState Decoder/Parser/Decryptor
The link that was here is now invalid. I found the parser at this location: http://sharptoolbox.com/tools/page-viewstate-parser
Denis Bauer's ASP.NET Version Switcher

2004-09-17

2004-09-08