Http Client Protocol Issues

If you use any of these solutions, Please let me know so I can track if any of this is useful to you! Thanks! This is an area to share observations I have made working with Http Client Protocols and the associated technologies. I currently work for the Microsoft team that supports the WinInet, WinHTTP and System.Net API's and classes associated with these technologies. This is not a replacement for Microsoft Support, but an area to discuss these technologies. These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified at Microsoft - Information on Terms of Use

  • Troubleshooting code that uses the HTTP protocol

    Overview

    You can solve issues encountered when using the HTTP protocol by applying the principles in this article.  By simplifying the issue into a small reproducible problem you can effectively troubleshoot and resolve most problems encountered in code that uses the HTTP protocol.  Crucial steps to troubleshooting code are: Gather Information, Simplify the Problem and Detailed Troubleshooting.

    Technologies Covered

    WinHttp, WinInet, Internet Explorer, XMLHTTP (MSXML), ServerXMLHTTP, System.Net classes such as WebClient, HttpWebRequest, SOAP classes, WebServices, System.Xml classes such as XmlUrlResolver, SoapHttpClientProtocol.

     

    Error Messages Encountered (so search will find this document)

    The operation timed out, 80072EE2, -2147954402, ERROR_WINHTTP_TIMEOUT, ERROR_WINHTTP_INVALID_SERVER_RESPONSE, The server name or address could not be resolved, 0x80072EE7, -2147012889, ERROR_WINHTTP_NAME_NOT_RESOLVED, 0x80072EFD

    -2147012867, A connection with the server could not be established, -2146697208 (800c0008), The download of the specified resource has failed, Cannot connect to Remote server, Access is Denied, System error: -2146697191, 401, 500, 407, Server refused connection, Http protocol violation, Unauthorized, Cannot find server.

     

    Step 1.  Gather Information

    You may solve the issue or get close to the root cause quickly by gathering information about the problem.  Then you can continue to the Simplify the Problem section of this document to further isolate the issue and determine where the problem is occurring. Do this only after Gathering the information listed below. 

     

    1.       What HTTP Verb are you using (EX: GET, POST, PUT)?

    2.       What is the destination URL?

    3.       Did this ever work? What changed if it did work previously (moved to production server, applied Service pack or Anti Virus update)?

    4.       What technology are you using to reach the URL that fails?

    5.       Can you reach the destination URL with another Technology such as Internet Explorer, other Browser, scripted Http Components, a simple console application?

    6.       Can you reach ANY URL from the computer (Perhaps DNS is not set, ports blocked, or you need a proxy setting)?

    7.       What is the failure (exact error message)? 

    8.       What is the call stack of the failure?

    9.       Is this a Desktop or service based application (ASP and ASP.NET is a service)?

    10.   Are you running with the latest Service Packs and fixes etc…(Go to Windows Update)?

     

    Step 2. Simplify the Problem

     

    Armed with the answers from Step 1, reproduce the problem with the simplest code possible.   In the process of simplifying the issue you may discover the issue is not in the technology you are using but a problem being obscured by your program’s logic or system configuration.  For example, In one case I assisted in, numerous troubleshooting actions had been taken in the ASP pages to determine what was going wrong.  When I was brought in to assist, I simply asked, “Can you hit the target URL in a Browser”?  The answer (“no”) instantly revealed to all of us that the issue was the DNS server setting on that machine and not the code.

     

    How to simplify the issue:

     

    1.       Duplicate the issue with a technology that is easier to troubleshoot such as the Web Browser or System.Net 2.0 which has the ability to log the HTTPS traffic.

    2.       If the problem occurs with HTTPS, see if you can reproduce with HTTP as well then troubleshoot HTTP traffic instead of HTTPS traffic (which is securely encoded).  If you cannot duplicate the issue with HTTP then the problem may lie with your HTTPS configuration.

    3.       If this is a service based application, such as ASP or ASP.NET, move the code out of the Service and test.  If it works, then the issue is not with the technology you are using.  The issue is how you have your service configured or the context it is running in.

    4.       Try simple code from script or a command line application to see if that succeeds.  Then use that same simple code in your application and test.  If it fails in either case you have a much smaller problem to deal with.

    5.       Simplify the code by executing the simplest possible HTTP call in a command line script or console application.  Start with using a HEAD or GET verb to a resource (perhaps an image or static file on the server) and add complexity until you get the failure.

     

    Below are some code samples you can use to simplify the problem.  Simplify!  For example if your application is doing a POST verb, start with a GET verb to start your troubleshooting and then only if you cannot duplicate the issue using the GET verb, move to the POST verb.

     

    VBScript samples:

     

    Dim aRequest

    Set aRequest = CreateObject ("Microsoft.XMLHTTP")

    aRequest.Open "GET","http://www.microsoft.com/",False

    aRequest.Send

    Wscript.Echo aRequest.responseText

     

    Dim aRequest

    set aRequest = CreateObject("Msxml2.ServerXMLHTTP")

    aRequest.Open "GET","http://www.microsoft.com/",False

    aRequest.Send

    Wscript.Echo aRequest.responseText

     

    Dim aRequest

    set aRequest = CreateObject("WinHttp.WinHttpRequest.5.1")

    aRequest.Open "GET","http://www.microsoft.com/",False

    aRequest.Send

    Wscript.Echo aRequest.responseText

     

     

    Dim aRequest

    Set aRequest = CreateObject ("Microsoft.XMLHTTP")

    aRequest.Open "POST"," http://www.contoso.com/PostAccepter.aspx",False

    aRequest.setRequestHeader "Content-Type","application/x-www-form-urlencoded"

    aRequest.Send "This is data"

    Wscript.Echo aRequest.responseText

     

    Dim aRequest

    set aRequest = CreateObject("Msxml2.ServerXMLHTTP")

    aRequest.Open "POST"," http://www.contoso.com/PostAccepter.aspx",False

    aRequest.setRequestHeader "Content-Type","application/x-www-form-urlencoded"

    aRequest.Send "This is data"

    Wscript.Echo aRequest.responseText

     

    Dim aRequest

    set aRequest = CreateObject("WinHttp.WinHttpRequest.5.1")

    aRequest.Open "POST"," http://www.contoso.com/PostAccepter.aspx",False

    aRequest.setRequestHeader "Content-Type","application/x-www-form-urlencoded"

    aRequest.Send "This is data"

    Wscript.Echo aRequest.responseText

     

     

    System.Net 2.0 console application samples:

     

    using System;

    using System.Net;

     

    namespace HttpWebRequestConsole

    {

        class Program

        {

            static void Main(string[] args)

            {

                try

                {

                    HttpWebRequest aRequest = WebRequest.Create("http://www.microsoft.com/") as HttpWebRequest;

    // if challenged with a 401, use current user's credentials       aRequest.UseDefaultCredentials = true;

                    HttpWebResponse aResponse = aRequest.GetResponse() as HttpWebResponse;

                    Console.WriteLine("Success. HttpStatus: {0}", aResponse.StatusCode);

                }

                catch (Exception theEx)

                {

                    Console.WriteLine(theEx.Message);

                }

                Console.ReadKey();

            }

        }

    }

     

    Simple .NET Post example:

    http://msdn2.microsoft.com/en-us/library/debx8sh9.aspx

     

    ASP samples (use only after trying simpler cases above – and simply embed the VBScript from above samples)

     

    ASPX samples (use only after trying simpler cases above - and the .NET 2.0 console app sample):

    <%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">

       

        void GreetingBtn_Click(Object sender,

                               EventArgs e)

        {

            // When the button is clicked,

            // change the button text, and disable it.

     

            Button clickedButton = (Button)sender;

            clickedButton.Text = "...button clicked...";

            clickedButton.Enabled = false;

           

            // Display the greeting label text.

            GreetingLabel.Visible = true;

     

            try

            {

                System.Net.WebClient aClient = new System.Net.WebClient();

          //proxy server if needed can be set here! aClient.Proxy = new System.Net.WebProxy("http://mycorpproxy:80" , true);

    //bypass proxy for local address = true

                GreetingLabel.Text = aClient.DownloadString("http://www.microsoft.com/");

     

            }

            catch (Exception theEx)

            {

                GreetingLabel.Text = theEx.Message;

            }

        }

     

    </script>

     

    <html>

    <head id="Head1" runat="server">

        <title>Untitled Page</title>

    </head>

    <body>

        <form id="form1" runat="server">

        <div>

          <h3>Simple Button Example</h3>

        

          <asp:Button id="Button1"

               Text="Click here for greeting..."

               OnClick="GreetingBtn_Click"

               runat="server"/>

          <br />

          <br />

          <asp:Label ID="GreetingLabel" runat="server"

                     Visible="false" Text="Hello World!" />

        </div>

        </form>

    </body>

    </html>

     

     

    Step 3. Detailed Troubleshooting

     

    DO NOT troubleshoot until you simplify the problem.  Get the problem isolated first to the simplest possible reproduction of the problem (following Step 2) and then proceed to this step.  For example: If you are having trouble hitting a WebService from ASP.NET and can reproduce the issue with a simple command line application written in .NET, you will be able to troubleshoot this much easier.

     

    Volumes of material could be written on this subject.  This document will not give you detailed troubleshooting steps but simply ideas to get you started.

     

    Search

    Many times after you have simplified the issue, you can search MSDN and use http://Search.Live.Com to find the issue and solution to your particular situation.

     

    Compare

    In almost every case you can gather data of a successful HTTP request and compare it to the failed case.  From this you can see what the difference is between the successful and failed request and correct the issue.  The problem may be missing or incorrect headers, data or authorization.

     

    Two useful tools for gathering HTTP traffic are ‘Network Monitor’ and ‘Fiddler’.  ‘Fiddler’ has the advantage of being able to execute requests you can construct yourself, the ability to see HTTPS traffic using a ‘man in the middle’ approach and will detect HTTP Protocol violations that the .NET classes will report as WebExceptions.  ‘Network Monitor’ has the advantage of showing you not only the HTTP traffic but the underlying TCP transport traffic.  This makes it a useful tool when the issue is the transport (TCP) instead of the protocol (HTTP).

     

    Both tools have excellent help documentation built into them.  Familiarize yourself with these help files and practice capturing data with them.

     

    Use Logging

    Another useful tool is logging.  WinInet and WinHttp as well as the System.Net based technologies have the ability to generate logs.  Often these logs will help you find problems and see exactly what is happening internally.

     

    WinHttp logging (also used by ServerXMLHttp): http://msdn2.microsoft.com/en-us/library/aa384119(VS.85).aspx  Vista and Above use netsh: http://msdn2.microsoft.com/en-us/library/bb648687.aspx

     

    WinInet logging (also used by XMLHTTP): http://support.microsoft.com/kb/884931

     

    System.Net logging:  http://msdn2.microsoft.com/en-us/library/ty48b824(VS.80).aspx

     

    See what is happening at the Protocol level

    Using Fiddler or Netmon, see if the server is responding.  If it is, what is the HTTP Status code?  A 407 means the Proxy needs credentials for authorization.  Make sure you are sending those credentials after the 407 comes back.  Similarly ensure your application responds to Server Authentication requests (HTTP Status Code 401).  If the server is responding 500 series of status codes, then the issue is on the server side.  Are you sending the correct data to the server?  Does the server work for the same exact query from different clients?  If not then the server programmer needs to resolve the issue.

    Capture traffic on the client and server to see if anything is altering or delaying the traffic between the two.

     

    Sporadic problems

    These are the most difficult to narrow down and a detailed discussion of this could fill a book (or website).  Many times the issue is a resource issue on the client or server.  You need to isolate the issue if possible to a simple repro at the time of failure.  You can try getting trapping 1st chance WebExceptions if using .NET or a .NET log to see what is happening.  Logging and network traces will be your best bet to solve most of these issues.  In the ASP.NET case, you may have to get a manual dump of the w3wp.exe process and engage Microsoft support for assistance.

     

    Perfmon counters may show you what is going on as well.  Ultimately you may have to get a Debug Dump and engage Microsoft Support if you cannot isolate the issue yourself.  When the problem occurs you can use DebugDiagnostics to get a couple of hang dumps and then analyze these dumps with that same tool and it will often suggest what the issue is and how to fix it.

     

    Other troubleshooting hints:

     

    Test the possibility of the Network causing the issue by putting the client and server on the same box.  If the problem goes away, then you may have an issue with the Network or network devices.

     

    Temporarily Eliminate load balancing and access a particular server directly so that you can determine if the load balancer is a factor and allow you to monitor a particular server while troubleshooting.

     

    Does the request look exactly the same as it left the client when it gets to the server?  Use  Netmon  to determine this.  It is possible that a Network device is altering packets in transit.

     

    Can any other client machine make the same request successfully?  It must be a configuration issue on the problem machine if other clients can get there.

     

    Is the problem only Http or Https traffic?  Https problems may be certificate related.  Ensure client certificate is installed in the Local Machine store for ASP/ASP.NET apps (see link below "How to call a Web service by using a client certificate for authentication in an ASP.NET Web application") or current user store for non service based apps if required.  Ensure the certificate chain is trusted by viewing the certificate chain in Internet Explorer.

     

    Does the request leave the box?  Use Netmon or Fiddler or tracing to determine this.  AntiVirus or firewall applications are suspect so temporarily disable them.

     

    Does any response come back from the server?  Use Netmon or Fiddler or tracing to determine this.  Perhaps the server is not responding due to server errors.  Inspect server logs and WebService logs.

     

    Some issues I have encountered:

     

    Not able to reach URL even with simplified code using different technologies. DNS or Proxy issues on network or on that particular machine could be the cause.  Try a different machine to confirm or narrow this down

     

    Can reach URL with one Technology but not another:  Common issues are:  Authorization not done correctly, Proxy settings, Firewall settings, or Antivirus is blocking the outgoing call.  Compare successful vs. failed cases to see what is happening.

     

    If you can reach that URL and successfully retrieve data using one technology but not another, then determine:

    ·         Does the HTTP traffic in both cases look the same?

    ·         Does the time for the response differ from one client to another?

    ·         Use various tools to determine the above to include; logging, Netmon 3.2, Fiddler, Simultaneous Netmon traces on client and target machines.  Fiddler can be configured to see the HTTPS traffic as clear text if it is an HTTPS only problem.

    ·         AntiVirus and Firewall programs can block the traffic and do this differently per process.  Test by turning them off.

     

    Sometimes you will see a 401 response in ASP.NET application and not in console app with same code.  The issue commonly is that the credentials passed by default are obtained from the security context that the program was running in and ASP.NET was not using the logged on credentials (search ASP.NET impersonation on MSDN).

     

    Helpful Links:

    Common ASP.NET issues related to http calls are usually resolved by following this article:  http://support.microsoft.com/?id=821268

    Fiddler Web Debugging Proxy - http://www.fiddler2.com/fiddler2/

    Current Netmon 3.1 http://www.microsoft.com/downloads/details.aspx?FamilyID=18b1d59d-f4d8-4213-8d17-2f6dde7d7aac&DisplayLang=en

    Troubleshooting HTTP 401 errors in IIS - http://support.microsoft.com/kb/907273

    Troubleshooting ASP.NET  - http://support.microsoft.com/kb/891032

    Troubleshooting common permissions and security-related issues in ASP.NET - http://support.microsoft.com/kb/910449

    Troubleshoot Forms Authentication - http://support.microsoft.com/kb/910439

    How to call a Web service by using a client certificate for authentication in an ASP.NET Web application http://support.microsoft.com/kb/901183

     

    Supplemental info

    Network monitor hints:

     

    How to get the IP addresses of the client and the server

                    a)  ipconfig /all on the client > client.txt

                    b)  ipconfig /all on the server > server.txt

     

    You can apply a filter to Netmon and see only Http traffic between the client and server (use ip addresses from above hint)

    192.168.1.1 //server

    AND

    192.168.2.2. //client

    AND

    HTTP  //our target protocol

     

     

  • window.close() freezes .NET 2.0 WebBrowser Control in Windows Form application

    In the spirit of my post: How To: Close the Form hosting the WebBrowser control when scripting calls window.close in the .Net Framework version 2.0 the .NET 2.0 WebBrowser control has no control over the close events like WindowClosing.  One valid solution is to use the ActiveX version of the WebBrowser control.  Currently the .NET 2.0 WebBrowser contol simply wraps the ActiveX version anyhow!

    Symptoms:  Create a .NET 2.0 Windows application and drop the Manged WebBrowser control from the toolbox on the form.  Navigate to a page that has jscript to close the window, for example:

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    <script language="javascript" type="text/javascript">
    // <!CDATA[

    function Button1_onclick() {
    window.close();
    }

    // ]]>
    </script>
    </head>
    <body>
        <a href="javascript:window.close();">When you click me I close!</a>
        <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
    </body>
    </html>

    When you click the button or hyperlink, the control will seem to freeze.

    Analysis:  This is a known issue.  What is happening is that the control is being released and coming down.  It looks like it is freezing.

    Workaround: 

    Remove the WebBrowser from your form and add the UnManaged control to your toolbox.

    To add the AxWebBrowser control make sure you are in design mode of a form.  Right click on the tool box and choose ‘Choose items…’.  Click on the COM Components tab and scroll down to find ‘Microsoft Web Browser’.  Check it and hit OK.  The WebBrowser will appear under the General Category of your toolbox items.

    Then drop the browser you added onto the form and sink the WindowClosing event of the browser from the design view properties.  Setting e.cancel to true will keep the Close from happening.  If you do nothing (don’t set e.cancel) the app will close.

        Private Sub AxWebBrowser1_WindowClosing(ByVal sender As System.Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_WindowClosingEvent) Handles AxWebBrowser1.WindowClosing

            e.cancel = True ' or do nothing and the app will close

        End Sub

     

     

     

  • Flash and Windows Media Player movies do not start in Internet Explorer

    An embedded WMP or Flash movie would not start when Internet Explorer loaded this page:

    <html>
    <BODY>
               
    <table width="100%">
      <tr>
        <td>
          <div style='width:100%; height:100%; margin:0px;'>

    <OBJECT ID="MediaPlayer" WIDTH=100% HEIGHT=100%
      CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
      STANDBY="Loading Windows Media Player components..."
      TYPE="application/x-oleobject"
    CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,

    1112">

      <PARAM name="autoStart" value="True">
      <PARAM name="filename" value="C:\Users\Public\Videos\Sample Videos\bear.wmv">

    <EMBED TYPE="application/x-mplayer2"
        SRC="http://WebServer/MyFile.wvx"
        NAME="MediaPlayer"
        WIDTH=100%
        HEIGHT=100%>
      </EMBED>
    </OBJECT>
        </div>
        </td>
      </tr>
    /table>


    </BODY>
    </html>

    Looking through the code I found that the control was not sent the OleControlSite Activate command that would start the display and the movie playing.

    Fix:  Change one of the size parameters to be Pixels instead of % and the movie will activate and run (true for Flash as well).  Alternatively you could have the jscript put focus on the control when the page loads which would have the same effect.

     

  • How to wire the readystatecomplete event from the XMLHttp object in InternetExplorer (.NET)

    I have a web page that has a global variable in the jscript called xmlhttp.  It is the build in XMLHttp object in Internet Explorer.  I am hosting the WebBrowser control in a C# (.NET managed code) application and I want to know when the XMLHttp object is done.  This occurs after the document complete event so how do I do this?

     Answer:

    This worked for me!  Using Visual Studio 2008:

    Create a new C# Windows Form Application Called XMLHttpReadyState
    Add a WebBrowser control to the form
    Double click on the WebBrowser in the form to add the documentComplete event handler.
    Add a function to wire the XMLHttp Event.

    Here is the commented code.  Let me know if this is useful and if it works out for you!

     

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Linq;

    using System.Text;

    using System.Windows.Forms;

    using System.Runtime.InteropServices;

    namespace XMLHttpReadyState

    {

    public partial class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    }

    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)

    {

    //when the document is done loading, wire up the XMLHttp object (if it exists)

    wireXMLHttpReadyState();

    }

    // This class is used for the readystatechange callback. This callback expects an IDispatch interface.

    // The constructor takes an Object which is the XMLHttp Obj so we can easily get the readystate.

    // You could also simply go get the ready state by navigating down from the webbrowser document object.

    [ComVisible(true)] //this is necessary or you get an Invalid Cast exception

    public class ReadyState

    {

    public ReadyState(Object theXMLHttpObj) { setObj( theXMLHttpObj); }

    // DispId 0 is what the XMLHttpObj will call, the name does not matter

    [DispId(0)]

    public void onMyImplOfreadystatechange()

    {

    if (m_XMLHttpObj != null)

    {

    Object theState = null;

    theState = m_XMLHttpObj.GetType().InvokeMember("readyState", System.Reflection.BindingFlags.GetProperty, null, m_XMLHttpObj, null);

    MessageBox.Show(theState.ToString());

    // State 4 means done

    if ((int)theState == 4)

    {

     

    // done so release the XMLHttpObj

    setObj(null);

    }

    }

    else

    {

    // should not happen!

    MessageBox.Show("XMLHTTP obj not set");

    }

     

    }

    public void setObj(Object theObj){m_XMLHttpObj=theObj;}

    private Object m_XMLHttpObj;

    }

    private void wireXMLHttpReadyState()

    {

    // get the DomDocument

    Object aDomObj = webBrowser1.Document.DomDocument;

    if (aDomObj!=null)

    {

    Object theScript = aDomObj.GetType().InvokeMember("Script", System.Reflection.BindingFlags.GetProperty, null, aDomObj, null);

    if (theScript != null)

    {

    // Get the script engine interface

    Object theXMLHttpObj = theScript.GetType().InvokeMember("xmlHttp", System.Reflection.BindingFlags.GetProperty, null, theScript, null);

    if (theXMLHttpObj != null)

    {

    // wrap the Object as an IDispatch COM interface and...

    Object toPass = new DispatchWrapper(new ReadyState(theXMLHttpObj));

    // pass it to the method in an argument array

    Object[] aArgs = new Object[1];

    aArgs[0] = toPass;

    theXMLHttpObj.GetType().InvokeMember("onreadystatechange", System.Reflection.BindingFlags.SetProperty, null, theXMLHttpObj, aArgs);

    }

    }

    }

    }

    }

    }

     

    Sample HTML:

    <html>
    <body onload='doxmlstuff();'>
    <script language="javascript">
    var xmlHttp = null;
    if (window.XMLHttpRequest) {
      // If IE7, Mozilla, Safari, and so on: Use native object.
      xmlHttp = new XMLHttpRequest();
    }
    else
    {
      if (window.ActiveXObject) {
         // ...otherwise, use the ActiveX control for IE5.x and IE6.
         xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
      }
    }
    var MyName = "Bill Gates";
    function ShowName()
    {
    alert("MyName = " + MyName);
    }
    function doxmlstuff()
    {
      if(xmlHttp)
     { 


    xmlHttp.open("GET", "http://jsandersrvista/test.xml", true);
    xmlHttp.send();
     }
    }
    </script>
    Hello there.<br>
    </body>
    </html>
     

     

  • Building with ATLServer based SOAP project with Visual Studio 2008

    When I tried to build an old ATLServer WebClient SOAP project I got these errors:

     

    fatal error C1083: Cannot open include file: 'atlsrvres.h': No such file or directory

    fatal error RC1015: cannot open include file 'atlsrvres.h'

     

    Download the latest ATLServer code from http://www.codeplex.com/AtlServer and unzip it on the build machine.

     

    Set the resource and C++ include paths of your project to point to the include folder location from the unzipped codeplex code.

     

    Rebuild.  I then got this error:

     

    error C2337: 'request_handler' : attribute not found

    error C2337: 'soap_handler' : attribute not found

     

    I found this thread (Orcas is Visual Studio 2008 now):

    http://www.codeplex.com/AtlServer/Thread/View.aspx?ThreadId=12010

     

    ATL Server attributes are not supported by Orcas compiler. You have to remove attributes from your code and get non-attributed ATL Server code that used to be injected by the compiler. To do this, recompile your code with /FX with the current version of compiler you are using. Here is more information about what /FX does - http://msdn2.microsoft.com/en-us/library/d8ex062w(VS.80).aspx. After compiler generated .mrg files, make a backup copy of your old source files and replace them with .mrg. files generated by /FX build. Rebuild your app with the current version of Visual Studio and make sure everything works as expected. Then port the code to Orcas and version of ATL Server from this project. You can comment out attributes now and Orcas compiler should build new source just fine.

      

    Note that the "current version of the compiler" means Visual Studio 2003 or Visual Studio 2005 since only they know how to handle the attributes.

     

    I did this and then had one more hurdle!

     

    error C2065: 's_szAtlsWSDLSrf' : undeclared identifier                    

     

    Add this to stdafx.h before the <atlsoap.h> include

     

    #include <atlspriv.h>

    _ATLSOAP_DECLARE_WSDL_SRF();

     

    Everything builds fine now.

  • msxml3.dll: Access is denied. msxml4.dll: Access is denied.

    The following vb Script can fail with an "Access is denied" error message:

    Dim aRequest
    Set aRequest = CreateObject ("Microsoft.XMLHTTP")
    aRequest.Open "POST","http://www.contoso.com/PostAccepter.aspx",False
    aRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    aRequest.Send "this is data"
    Wscript.Echo aRequest.responseText

    If you use Fiddler (http://fiddler2.com) you will see a comple of redirects to Microsoft.com.  That is the reason for this failure in my case.  By clearing the flag in Internet Explorer for that internet zone that prevents this POST (Access data sources across domains), I am able to run again.

    1. In Internet Explorer, click Internet Options on the Tools menu.
    2. On the Security tab, click Trusted sites, and then click Sites.
    3. Add your site to the zone.
    4. Click Custom Level.
    5. Under Miscellaneous/Access data sources across domains, click Enable.

     

    see http://msdn.microsoft.com/en-us/library/cc507438(VS.85).aspx (security model)

    also see http://support.microsoft.com/?id=820882

     

    Posted