All About SharePoint

Liedong(Ken) Zheng,SharePoint Leader at SIMPLOT

Posts Tagged ‘Proxy’

Error occured Accessing Data Source Error ID 5566 in Infopath Web Form on SharePoint

Posted by ken zheng on December 21, 2010

 

We used "Userprofileservice" in infopath form to populate user’s details. It works perfectly on client form but once convert to UDC and open in the web form. It gets error:

A runtime exception was detected. Details follow.
Message: The remote server returned an error: (503) Server Unavailable.

Techinal Details:
System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
   at System.Net.HttpWebRequest.GetResponse()

I know this is proxy error but still spent hours trying to solve the problem. Here are the list you need to check:

A. Disable the authentication loopback check

Re-enable the behavior that exists in Windows Server 2003 by setting the DisableLoopbackCheck registry entry in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa registry subkey to 1. To set the DisableLoopbackCheck registry entry to 1, follow these steps on the client computer:

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  3. Right-click Lsa, point to New, and then click DWORD Value.
  4. Type DisableLoopbackCheck, and then press ENTER.
  5. Right-click DisableLoopbackCheck, and then click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. Exit Registry Editor.
  8. Restart the computer.

B. Enable the Web Service Proxy for InfoPath Service in Central Admin

image

C.  Make sure the “UseFormsServiceProxy” attribute is set to True

image

D. Check the Proxy Setting in web.config, and I added the url in the bypasslist that look like our SPNs aren’t set up correctly.

  <system.net>
    <defaultProxy>
      <proxy usesystemdefault="false" proxyaddress="http://xx.xx.xx.xx:8080/" bypassonlocal="true" />
      <bypasslist>
         <add address="moss.company.local" />
      </bypasslist>
    </defaultProxy>
  </system.net>

Incidentally, the <bypasslist> element allows you to use Regular Expression like “xxx.xxx*” to specify addresses, so you can exclude whole ranges at will – quite neat.

NB: Remember to IISREST or recycle to clear the server cache

Posted in Sharepoint | Tagged: , | 2 Comments »

Pass Proxy Server URL rto HTTPWebRequest

Posted by ken zheng on November 30, 2010

Below is the example code that you can pass proxy server url

            HttpWebRequest webRequest = null;
            string strResult = null;
            try
            {
                // Create a new web request
                webRequest = WebRequest.Create(url) as HttpWebRequest;
                // Check if ProxyServerUrl in the appSettings is not empty
                if (!string.IsNullOrEmpty(WebConfigurationManager.AppSettings["ProxyServerUrl"].ToString()))
                {
                    // instantiate a new WebProxy class and send the ProxyServerUrl to the contructor parameter
                    System.Net.WebProxy proxy = new System.Net.WebProxy(WebConfigurationManager.AppSettings["ProxyServerUrl"].ToString(), 
true);
                    // Set the proxy credentials
                    proxy.Credentials = new NetworkCredential(WebConfigurationManager.AppSettings["PassThroughUser"].ToString(),
 WebConfigurationManager.AppSettings["PassThroughPwd"].ToString());
                    // Set the WebRequest proxy property by the WebProxy class already configured
                    webRequest.Proxy = proxy;
                }
                // Read the response
                using (StreamReader sr = new StreamReader(webRequest.GetResponse().GetResponseStream()))
                {
                    // Set strResult to the response
                    strResult = sr.ReadToEnd();
                }
            }
            catch
            {
            }

Posted in vs2010 | Tagged: | 1 Comment »

The remote server returned an error: (503) Server Unavailable.: at System.Net.HttpWebRequest.GetResponse()

Posted by ken zheng on September 24, 2010

This error did cause me headache, after try after try. I found you need to turn off the proxy.

if your code is behind the proxy then pass

webrequrobj.proxy=null;

use this part before getresponse

reqFTP.Credentials = new NetworkCredential(Username, Password);
reqFTP.KeepAlive = false;
reqFTP.Proxy = null;

Same to the web service.

WSSimcentral.UtilityWebService ws = new WSSimcentral.UtilityWebService();           
ws.Url = "http://xxx/_layouts/UtilityWebService.asmx";

ws.Credentials = System.Net.CredentialCache.DefaultCredentials;
ws.PreAuthenticate = true;
ws.Proxy = null;

Posted in Sharepoint | Tagged: , | 1 Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 28 other followers