locked
fail to invoke webservice RRS feed

  • Question

  • I write an outlook addin in C# and it invokes a cli c++ dll.

    In the dll, it fails to invoke webservice method in some machines of windows 7.

    I debug and find error codes in atlspriv.inl and atlhttp.ini.

    I think it's thread synchronization.I fixed it by modifying microsoft codes.solution is as follows:

    Syncdatacomponentdll fail to call webservice method in some machines of windows 7.This is a Microsoft bug. It’s related to thread synchronization.

     

    The Error codes are in the files of vs2005. So please modify them.

    1.                             %intallpath%(such as C:\Program Files\Microsoft Visual Studio 8) \VC\atlmfc\include\atlhttp.inl

     

    Function: inline bool CAtlHttpClientT<TSocketClass>::ReadSocket() throw()

    Source error codes:

    if (!bRet)

       return bRet;

     

    Correct codes:

    //fix microsoft bug happen in some machine of windows 7!

                    if (!bRet)

                    {

                       int nNum = 0;

                       while(nNum<30)

                       {

                            Sleep(1000);

                            bRet = Read(read_buff, (DWORD*)&dwSize);

                            if(bRet)

                                break;

                            nNum++;

                       }

                       if (!bRet)

                            return bRet;

    }

     

    Function: inline typename CAtlHttpClientT<TSocketClass>::HTTP_RESPONSE_READ_STATUS CAtlHttpClientT<TSocketClass>::ReadHttpResponse()

    Source error codes:

    pBodyBegin = FindHeaderEnd(&pHeaderBegin);

                    if (!pBodyBegin)

    {

    Correct codes:

    pBodyBegin = FindHeaderEnd(&pHeaderBegin);

                    if (!pBodyBegin)

    {

                       //fix microsoft bug happen in some machine of windows 7!

       Sleep(10000);

    2.                             %intallpath%(such as C:\Program Files\Microsoft Visual Studio 8) \VC\atlmfc\include\ atlspriv.inl

    Function: inline bool ZEvtSyncSocket::Connect(const SOCKADDR* psa, int len)

    Source error codes:

    dwLastError = WSAGetLastError();

                    if (dwLastError != WSAEWOULDBLOCK)

                    {

                       m_dwLastError = dwLastError;

                       bRet = false;

    }

    Correct codes:

    //fix microsoft bug happen in some machine of windows 7!

                    DWORD dwLastError2 = GetLastError();

                    dwLastError = WSAGetLastError();

                    if (dwLastError != WSAEWOULDBLOCK&&dwLastError2 != WSAEWOULDBLOCK)

                    {

                       m_dwLastError = dwLastError;

                       bRet = false;

    }

     

    But I think it's not a perfect solution. Does anybody meet the problem and find perfect solution?

    I am looking forward to your reply.thanks!

    • Moved by Bin-ze Zhao Friday, September 17, 2010 3:51 AM not c# related (From:Visual C# Language)
    Friday, September 10, 2010 9:52 AM

All replies

  • Hi,

    This obviously is not a c# problem, what's the error message in your case?

    Thanks

    Binze


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, September 14, 2010 5:49 AM