Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Eventhandler issue after upgrading to .net 4 and vs2010

  1. #1
    allstar is offline Member
    Join Date
    Apr 2009
    Posts
    90

    Default Eventhandler issue after upgrading to .net 4 and vs2010

    I am receiving the exception below in the CallEvent function after ugprading my store application to .net 4 and vs2010. Has anyone run into this issue? Please post solution.

    Exception: You must write ContentLength bytes to the request stream before calling [Begin]GetResponse.
    ...AllStar

  2. #2
    John Morrison is offline Junior Member
    Join Date
    Sep 2008
    Posts
    20

    Default

    After so much time i am sure you have already figured this out. I am not sure if you are using 9.1.0.1 but I was and ran in to the same issue.

    I dont know if the behavior of BeginGetRequestStream changed in .net 4 , In order to fix this i needed to modify the source code and move some things out in the eventhandler.. If you are interested and have a full source code license i can provide you with fix to properly use the aspdotnetstorefront eventhandlers in .net 4


    To outline the fix: You would need to move the lines containing BeginGetResponse as well as the ThreadPool.RegisterWaitForSingleObject in the event handler to the ReadCallbackRequest callback method. Then delete the rs.ResponseStream.Close line.

    The reason for the error is because the original code is trying to lauch both the
    BeginGetRequestStream and the BeginGetResponse simultaneously on two different thread however BeginGetRequestStream needs to complete before BeginGetResponse is called.

    Moving BeginGetResponse to the delegate ReadCallbackRequest makes sure the post completed before we try to read the response from it.

  3. #3
    verishare is offline Junior Member
    Join Date
    Jul 2009
    Location
    Yakima,WA
    Posts
    5

    Default

    We are running 9.2 and having problems getting handlers to work. I can get it to fire once or twice and then nothing. Any insight would be appreciated. We have the source. Thanks.