Tuesday, July 12, 2011

c# .NET HttpWebRequest slow - Expect 100 continue!

Another tech stuff, at least as I am not posting lately. So, we were sending HTTP requestso the server and against a previous (3rd party) version it was extremely slow. Any browsing would suggest to change buffering, async mode or turning off proxy, but none helped.

When we changed POST to GET, this problem dismissed!
When we rewrote using sockets, the problem dismissed, but could not take the risk of an own implementation on a production system.

Profiling showed the bottleneck is this line:
HttpWebResponse r = (HttpWebResponse)request.GetResponse();

the poll method. Finally the solution was
Expect 100 Continue
Never heard of? :) What a surprise, turn itt off and give it a try. For further explanation search the web for it.

System.Net.ServicePointManager.Expect100Continue = false;
or
request.ServicePoint.Expect100Continue = false;

Good luck.

Wednesday, April 6, 2011

Lonely red piano story

Pics from ph-art

Sorry, pics are not displayed, need to figure out how to embed. but if you click, you will be redirected.

Update: Pics should be visible by now, i got it :)


Thursday, March 17, 2011

VS Express Edition - Start external program solution

"As you've noticed, this functionality is not available in Express. This is one of the many places where the IDE has been simplified..." words of Luke Hoban on social.msdn.microsoft.com.

It's not simplyfication, it is just taking away basic functionality and getting money from users. The postbuild event idea is not bad, but will start the application every time and I am not sure about debugging, if you need to attach to a process or it is done automatically. Here comes a solution, you need to edit the .user file of your project: .vcproj.user for C++ or .csproj.user for C#, probably similar for VB.

For C++ find a Configuration and edit|add DebugSettings:


<debugsettings
Command="C:\Program Files\Adobe\FrameMaker7.1\FrameMaker.exe"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine=""
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor="0"
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>


C#:

<project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<propertygroup condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<startaction>Program</startaction>
<startprogram>C:\Program Files\Adobe\FrameMaker7.1\FrameMaker.exe</startprogram>
<startarguments/>
<startworkingdirectory/>
</propertygroup>
</project>



Good luck debugging your libraries with Express edition.