Friday, September 19, 2008

Simple problem, and not so obvious solution

Hello,

I have abandoned this blog, but it seems that nothing is ever abandoned on the internet :)
Apparently one of my posts actually helped.
And there was also one comment, that I have seen too late to help (sorry Kiran, hope you solved the problem).
So I am going to continue posting new interesting solutions, to some nasty problems.

Here we go...
PROBLEM:
You are using dsoFramer.ocx control to host some fine Microsoft office documents on your web page. Everything is going excellent, you find out even how to download files directly from web address into dsoFramer, and then, you Publish project to working environment, and THE problem start....
You download some files from web server to client in IE using dsoFramer.ocx control, but it seems that IE reloads files from cache.... you change files on local machine, upload it.... you try to do download... but it appears that files are read from Temporary Internet Files directory!

SOLUTION:
(Too simple to be true... but after you clear Temporary Internet Files directory on test client(s) [clear cached data] , and apply following tip in IIS... you will solve problem )
For IIS5.1 (standard XP sp2)
Go to Internet Information Services.... open directory where your files are kept (files that are downloaded to client). Right-click ... properties.... Http Headers...
add to CustomHeaders, following:

Custom Header Name:
Cache-Control
Custom Header Value:
no-cache

On IIS 7... Instead of HttpHeaders, try Http Response Headers, it should work.

Also, if somebody has problem with dsoFramer.ocx control, let me know.

Friday, June 8, 2007

Create of test certificate for printer signing

Forget OpenSSL.... use MakeCert.exe from VS it is much better for windows uses.

Use this input to makecert, so that it create certificate that you import in cert store. Then you import it into trusted root cert store. And voila you have cert for testing your printer drivers.

makecert -r -pe -n "CN=XYZ Company" -sky exchange -ss my certname.cer

Thursday, June 7, 2007

Problems, just keep on coming

Problem:
EventType clr20r3, P1 kimofflinetoonline.exe, P2 0.6.0.1012, P3 464b389a, P4 kimofflinetoonline, P5 0.6.0.1012, P6 464b389a, P7 10, P8 1ab, P9 system.io.ioexception, P10 NIL.


Solution:
1. Enlarge socket timeout size both on receiving and sending side (if that do not solve problem, then use 2.)
2. This one is tricky :)
You are probably using some kind of TCP socket server, and client, and you are trying to spawn threads (with new TCP socket) at client side that access server , as fast as possible.
And after 4000-5000 spawned threads.... you get this error.
Why? Well Windows have default limitation on user created TCP sockets to around 5000.
To solve the problem, you have to add new key into registry.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort (as DWORD value) and to set it to value lesser then 65535 (max tcp port count).
I set it to 65534 and did not had any problems with it. This solution is working fine on real time C# server on win2003.

If this helps, great.... when you solve something like this.... post in blog, so we all can spare less time on searching for solutions, and more on coding.

keywords:
TCP/IP, how to avoid socket number limitation, .NET socket error , problems with sockets , TcpClient timeout

Fancy .NET 2.0 error code

Well, today i got another issue with .NET 2.0. This one was solved once before, so... i need to find out what is the problem.... again.

Problem:
EventType clr20r3, P1 kimofflinetoonline.exe, P2 0.6.0.1012, P3 464b389a, P4 system.data, P5 2.0.0.0, P6 4333aea2, P7 25c3, P8 29, P9 system.data.sqlclient.sql, P10 NIL.

Solution:
Check your connection string for privileges, user id, and general database accesibility (firewalls , clusters .....).