title: SharePoint 2010 WCF RESTful Authentication Issue with Anonymous Authentication Publishing Site
body: <p>I have a SharePoint 2010 Publishing Site with Allow Anonymous Access turned on and I am having some problems with using the WCF RESTful data access...</p>
  
  <p>First when I try to create a datasource in Visual Studio 2010 to listdata.svc it fails unless I go into IIS and disable Anonymous Authentication on the _vti_bin. If I disable Anonymous Authentication on the _vti_bin I am able to add the datasource without error. </p>
  
  <p>Second if I have Anonymous Authentication disabled on the _vti_bin and try to connect with SharePoint Designer I get an error after being prompted for my Username/password.</p>
  
  <p>Third if I have Anonymous Authentication allowed on the _vti_bin and try to run my WCF RESTful code it appears that the credentials that are passed in are not used. See Code</p>
  
  <pre><code> static void Main(string[] args)
      {  
          MySite.MySiteDataContext dc = new MySite.MySiteDataContext(new Uri("http://mysite/_vti_bin/ListData.svc/"));
  
          dc.Credentials = new NetworkCredential("user", "password", "domain");
  
  
          var q = from m in dc.Products
                  select m;
  
  
          foreach (var i in q)
          { 
  
             //never gets in here when Anonymous Authentication is allowed on the _vti_bin       
             //when Anonymous Authentication is disabled on _vti_bin this code runs without issue. 
  
          }
      }
  </code></pre>
  
  <p>So... Can anyone tell me what I am doing wrong or if there is a work around for this issue? </p>
  
  <p>Environment:</p>
  
  <p>SharePoint 2010
  Publishing Site with Anonymous Access Turned On
  Code running in console application not on same server as SharePoint Server.</p>