Provider-hosted Apps debug error: The remote server returned an error: (401) unauthorised

Hi,
Any help appreciated!!
I'm getting this error: "The remote server returned an error: (401) unauthorised when I debug a provider-hosted app.  I get the error on this line:  
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
See code below
I created a high trust development environment following the instructions provided here:
http://msdn.microsoft.com/en-us/library/office/fp179901(v=office.15).aspx and
http://msdn.microsoft.com/library/office/fp179923
I created a provider-hosted app with the intent to:
create a SharePoint list in the appweb
Use self-signed certificate, tokenhepler.cs and sharepointcontext.cs to retrieve current user context and access on SharePoint.  (No changes were made to tokenhelper.cs and sharepointcontext.cs)
retrieve list items from the SharePoint list in a button click event handler on a default.aspx of the remote web
What happens:
The app is deployed successfully to the Dev site
The SharePoint feature is deployed and activated
The default.aspx page of the remote web loads
The error (see image) is returned on clicking of the button
My environment is an on-premise SharePoint 2013 with AD and my dev box is standalone windows 8.1 running Visual Studio Professional 2013 Update 3.
The code block below is a copy of the default.aspx code-behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.Client;
using Microsoft.IdentityModel.S2S.Tokens;
using System.Net;
using System.IO;
using System.Xml;
using System.Data;
using System.Xml.Linq;
using System.Xml.XPath;
namespace Idea.GeneratorWeb
public partial class Default : System.Web.UI.Page
SharePointContextToken contextToken;
string accessToken;
Uri sharepointUrl;
protected void Page_PreInit(object sender, EventArgs e)
Uri redirectUrl;
switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
case RedirectionStatus.Ok:
return;
case RedirectionStatus.ShouldRedirect:
Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
break;
case RedirectionStatus.CanNotRedirect:
Response.Write("An error occurred while processing your request.");
Response.End();
break;
protected void Page_Load(object sender, EventArgs e)
//// The following code gets the client context and Title property by using TokenHelper.
//// To access other properties, the app may need to request permissions on the host web.
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
//var spContext = new ClientContext("MySPDevInstance");
//spContext.Credentials = new NetworkCredential("username", "password");
//using (var clientContext = spContext.CreateUserClientContextForSPHost())
// clientContext.Load(clientContext.Web, web => web.Title);
// clientContext.ExecuteQuery();
// Response.Write(clientContext.Web.Title);
string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
if (contextTokenString != null)
// Get context token
contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);
// Get access token
sharepointUrl = new Uri(Request.QueryString["SPAppWebUrl"]);
accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;
// Pass the access token to the button event handler.
Button1.CommandArgument = accessToken;
protected void Button1_Click(object sender, EventArgs e)
// Retrieve the access token that the Page_Load method stored
// in the button's command argument.
string accessToken = ((Button)sender).CommandArgument;
if (IsPostBack)
sharepointUrl = new Uri(Request.QueryString["SPAppWebUrl"]);
// REST/OData URL section
string oDataUrl = "/_api/Web/lists/getbytitle('Diagrams In Idea Generator')/items?$select=Title,Diagram,SharingStatus";
// HTTP Request and Response construction section
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + oDataUrl);
request.Method = "GET";
request.Accept = "application/atom+xml";
request.ContentType = "application/atom+xml;type=entry";
request.Headers.Add("Authorization", "Bearer " + accessToken);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Response markup parsing section
XDocument oDataXML = XDocument.Load(response.GetResponseStream(), LoadOptions.None);
XNamespace atom = "http://www.w3.org/2005/Atom";
XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
XNamespace m = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
List<XElement> entries = oDataXML.Descendants(atom + "entry")
.Elements(atom + "content")
.Elements(m + "properties")
.ToList();
var entryFieldValues = from entry in entries
select new
Character = entry.Element(d + "Title").Value,
Actor = entry.Element(d + "Diagram").Value,
CastingStatus = entry.Element(d + "SharingStatus").Value
GridView1.DataSource = entryFieldValues;
GridView1.DataBind();
Any ideas what I might be doing wrong

Hi ,
Use the below code
Public string GetAccessToken(){
string sharePointSiteUrlHost =  Page.Request["SPHostUrl"].Tostring();
string AccessToken = tokenHelper.GetS2SAccessTokenWithWindowsIdentity(sharePointSiteUrlHost, Request.LogonUserIdentity);
return accessToken;
Than initialize the ClientCOntext with the below Method
 private static ClientContext GetClientContextWithAccessTokenString(string targetUrl, object accessToken)
            ClientContext clientContext = new ClientContext(targetUrl);
            clientContext.AuthenticationMode = ClientAuthenticationMode.Anonymous;
            clientContext.FormDigestHandlingEnabled = false;
            clientContext.ExecutingWebRequest +=
                delegate(object oSender, WebRequestEventArgs webRequestEventArgs)
                    webRequestEventArgs.WebRequestExecutor.WebRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
                    webRequestEventArgs.WebRequestExecutor.RequestHeaders["Authorization"] =
                        "Bearer " + accessToken;
            return clientContext;
use this clientCOntext and it will work.
Do not use
SharePointContextProvider
Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

Similar Messages

  • Error occurred in deployment step 'Uninstall app for SharePoint': The remote server returned an error: (502) Bad Gateway.

    Installed SP 2013 Foundation in my Hyper-V machine
    Created and done all the steps mentioned here http://blogs.msdn.com/b/shariq/archive/2013/05/07/how-to-set-up-high-trust-apps-for-sharepoint-2013-amp-troubleshooting-tips.aspx && http://msdn.microsoft.com/en-us/library/office/fp179901%28v=office.15%29.aspx
    for self signed certificate
    copied those two certificates in my local machine(base machine) D drive
    (D:\Cert)
    Both VM and base machine are in same domain
    Installed VS 2013 in my base machine and create a Provided hosted app with the copied certificates, (For creation i followed the above mentioned URL)
    Just created and hit F5 to run in my base machine, but getting this error
    Error occurred in deployment step 'Uninstall app for SharePoint': The remote server returned an error: (502) Bad Gateway.
    Please help me to resolve this issue, trying to figure out from last 2 days
    Thanks in Advance
    Arun

    Hi Harminder,
    This happens because an app has already been deployed and you are deploying it again using the same version.
    Resolution:
    Open the AppManifest.xml file and change the version.
    Vivek Jagga - MCTS SharePoint
    SharePointExcellence

  • BizTalk to Web Service - Error - The remote server returned an error: (403) Forbidden.

    Hi Everyone,
    I am connecting to an external web service from my biztalk application through a dynamic send port.
    When my biztalk application is trying to send the request message to the web service through the send port, I am getting the following error :
    The remote server returned an error: (403) Forbidden. 
    The external web service team have provided a certificate and a private key to install in my server. 
    I have installed the certificate by double click the .pfx file using the private key and have added the certificate in the host ProcessHostx64. 
    Still i am getting the same error.
    Can someone help on this issue ?
    Many Thanks,
    Anand
    S B A

    The Private Key should be installed under the user running the BizTalk Server Host. Please confirm that you have done this?
    If so, try to make this work in a small .NET test Application before porting it to BizTalk, so that you can confirm that you do have sufficient credentials to call the Service.
    Morten la Cour

  • ADFDi  Error : The remote server returned an error: (411) Length Required

    JDeveloper version 11.1.2.1.0
    weblogic Version 10.3.5.0
    Hi All,
    From ADF Desktop integration application, When the user key in username and password the system show the following error message. Please help to me how to tackle it as well as useful blogs.
    Regards
    KT
    Error Detail:
    WebException: The remote server returned an error: (411) Length Required.
    Source: System
    Stack:
    at System.Net.HttpWebRequest.GetResponse()
    at oracle.adf.client.windows.common.internet.http.ManagedHttpResponse..ctor(HttpWebRequest request)
    at oracle.adf.client.windows.common.internet.http.ManagedHttpRequest.GetResponse()
    at oracle.adf.client.windows.datamanager.servletrequest.SyncRequest.BeginResponse()
    at oracle.adf.client.windows.datamanager.servletrequest.TamperCheckRequest.InternalCallSyncServlet()
    at oracle.adf.client.windows.datamanager.servletrequest.SyncServletRequest.CallSyncServlet(Boolean retry)
    at oracle.adf.client.windows.datamanager.ADFBindingContext.SendSyncServletRequest(SyncServletRequest request)
    at oracle.adf.client.windows.datamanager.ADFBindingContext.CheckForTampering()
    at oracle.adf.client.windows.datamanager.ADFBindingContext.PreSyncServletTamperCheck()
    at oracle.adf.client.windows.datamanager.ADFBindingContext.SyncModel(BindingContainer bc, String contentType)
    at oracle.adf.client.windows.datamanager.BindingContainer.Repopulate()
    at oracle.adf.client.windows.datamanager.BindingContainer.SyncModel(Boolean forceSync)
    at oracle.adf.client.windows.excel.runtime.uicomponent.RTActionCollection.DoInvoke(RTColumnCollection parent, String contextLabel)

    In which environment is your application hosted? Are there any other network components sitting between the client and the application, such as CDN or load balancer?
    It would be very helpful if you can capture the client-side HTTP traffic using some tools (e.g. Fiddler - http://www.fiddler2.com/fiddler2/), so that we can know where the "401 length required" error is sent from by looking at the header of the HTTP response of the error.

  • WCF Error: The remote server returned an error: Not Found

    I have a windows phone8 app that utilizes a azure WCF service. I added the Servicereference to my project,when i call the service method it executes fine but getting the following error after executing:
    System.ServiceModel.CommunicationException: The remote server returned an error: Not Found
    Here's the code where my error's occuring (the error occurs on the 2nd line of code within the method(the line that contains "_result =
    public string EndSendMessage(System.IAsyncResult result) {
                    object[] _args = new object[0];
                    string _result = ((string)(base.EndInvoke("SendMessage", _args, result)));
                    return _result;
    Any idea why this is happening?
    Thanks.

    Hi Narendramacha,
    It may be have more than one possibility reasons. Did you try the service URL in the phone/emulator Internet Explorer to be sure the url is accessible ? About this error, I found some solutions , please refer to :
    1.maxStringContentLength: http://stackoverflow.com/a/5185678
    2.FireWall: http://stackoverflow.com/a/15594388
    Please try it. Any results, please let me know.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Urgent help On as2 error The remote server returned an error: (500) Internal Server Error.

    hi,
    im configured the as2 partner setup as per this http://msdn.microsoft.com/en-us/library/bb246129(BTS.20).aspx.
    but when im process file , then file try hit partner url goes dyhradated state,then failed. then i got below error.
    The remote server returned an error: (500) Internal Server Error.
    please any help..
    Thanks

    500 server error could be due to anyone of the following reasons:
    Party configuration is wrong. Party properties/configurations have  to be discussed upfront with the source/destination system and have to be in-line with
    them.
    Certificates have to be deployed in correct folders based on      certificate types like private/public/signed etc.
    Firewall (or network components) has to be opened accordingly for parties(systems) to interact. This change has to be done at the both the levels, source and destination.
    If you receive it through HTTPReceive.dll (may uses this for AS2), you have to check its configurations.
    Also 500 error, could occur even if your BizTalk artifacts has not been configured/deployed/enabled properly.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • FTP Error (The remote server returned an error: (530) Not logged in.)

    Hi,
    I am unable to create a folder on FTP location via c# code. 
    I am getting the following error message:
    The remote server returned an error: (530) Not logged in.
    I have attached my code for your reference.
    FtpWebRequest myFtpWebRequest = null;
    myFtpWebRequest = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpfullpath + "/" + dirName));
    myFtpWebRequest.Method = WebRequestMethods.Ftp.MakeDirectory;
    myFtpWebRequest.UseBinary = true;
    myFtpWebRequest.Credentials = new NetworkCredential(strUserNameFTP, strPasswordFTP);
    FtpWebResponse response = (FtpWebResponse)myFtpWebRequest.GetResponse();
    response.Close();
    Note : value of ftpfullpath is "ftp://ftpxxxtest.com:21"

    Hi,
    Still I am getting the error:
    Exception 1 : The remote server returned an error: (502) Command not implemented
    I am getting this error message when I tried to find Whether the folder exist on FTP location. I will attached the code for your review.
    try
      string ftpServerIP = "ftp://ftptestcon.sathiyajeba.com:21";
      string strUserNameFTP = "dev_backup";
      string strPasswordFTP = "india@2090";
      string ftpfullpath = ftpServerIP ;
      var request = (FtpWebRequest)WebRequest.Create(ftpfullpath + "/" + directory);
      request.Credentials = new NetworkCredential(strUserNameFTP.Normalize(),   strPasswordFTP.Normalize());
      request.EnableSsl = true;
      request.Method = WebRequestMethods.Ftp.GetDateTimestamp;
      FtpWebResponse response = (FtpWebResponse)request.GetResponse();
      return true;
    catch (WebException ex)
      WriteLog("Error on FtpDirectoryExists : " + ex.Message.ToString());
      FtpWebResponse response = (FtpWebResponse)ex.Response;
      if (response.StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable)
        WriteLog("Error on FtpDirectoryExists : Test-1");
        return false;
      else
        WriteLog("Error on FtpDirectoryExists : Test-2");
        return false;
    Exception 2: The remote server returned an error: (530) Not logged in.
    Getting this error message when I tried to create a folder on FTP location. Attached the source code for your review.
    string ftpServerIP = "ftp://ftptestcon.sathiyajeba.com:21";
    string strUserNameFTP = "dev_backup";
    string strPasswordFTP = "india@2090";
    string ftpfullpath = strServerFTP;
    try
       FtpWebRequest myFtpWebRequest = null;
       myFtpWebRequest = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpfullpath + "/" + dirName));
       myFtpWebRequest.Method = WebRequestMethods.Ftp.MakeDirectory;
       myFtpWebRequest.UseBinary = true;
       myFtpWebRequest.Credentials = new NetworkCredential(strUserNameFTP.Normalize(), strPasswordFTP.Normalize());
      FtpWebResponse response = (FtpWebResponse)myFtpWebRequest.GetResponse();
      response.Close();
      return true;
    catch (Exception ex)
      WriteLog("Error on CreateDirectory : " + ex.Message.ToString());
      return false;
    Could you please any help me to resolve this exception?
    Thanks,
    Sathiya Jeba C

  • When using the OData Source I receive error "The remote server returned an error: (403) Forbidden. (System)"

    I get this error once I click the "Test Connection" button in the OData Connection manager. I am working against an O365 SharePoint List. I will add that I have this working just fine when running it from my Windows 8 workstation using Visual Studio
    2013.
    On my Windows 2012 R2 Server, using Visual Studio 2013 is wen I encounter the error so I know I have the connection settings correct.  I am going against the same SP list using the same credentials.  The only difference is when running on Server
    2012 vs. Winodws 8 workstation.  I don't know if there are some other security settings that need to be applied.
    I will also add that I can access on premise list successfully,  I am only having this issue with O365 List.
    Any help would be appreciated.  Thanks.
    Jim

    It might be due to the “Microsoft Online Services Authentication” NOT set to true.
    See
    http://whitepages.unlimitedviz.com/2014/03/using-the-odata-source-connector-with-sharepoint-online-authentication/
    Arthur
    MyBlog
    Twitter

  • Error: The remote server returned an error: (409) Conflict

    I'm doing a simple receiver with EventProcessorHost and getting this error.
    It happens when I debug receiver.
    The ProcessEventsAsync() has a loop by events. Seems the loop processes the first event then throw this exception. The strange thing is, the loop can be started with events collection from one item, but the loop is trying to process the second item...
    Leonid Ganeline [BizTalk MVP]

    I've found out the issues. Yes, they are two, my bad. The main issue was in custom code, irrelevant to EventHub. I faulted by localize the error to the EventHub, but it was not it.
    The secondary issue was, I called GetBytes() second time on the EventData body, which is not allowed. Body can be read only once!
    Leonid Ganeline [BizTalk MVP]

  • Provider hosted app error message: The remote server returned an error: (429) Too Many Requests.

    Hi,
    I have a customer running a provider hosted app and in Sharepoint 2013. Things have been working fine but recently they keep experiencing an issue where the all the app parts on the page show the following error message. Does anyone have an idea what
    could be causing this problem and how I can fix it? The Sharepoint site and provider hosted app site are running on a Server 2008 R2 box with IIS 7.5.
    Server Error in '/Test.Sharepoint.App' Application.
    The remote server returned an error: (429) Too Many Requests.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.           
    Exception Details: System.Net.WebException: The remote server returned an error: (429) Too Many Requests.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [WebException: The remote server returned an error: (429) Too Many Requests.]
    System.Net.HttpWebRequest.GetResponse() +8527180
    Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() +58
    Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) +975
    Test.Sharepoint.AppWeb.Pages.LatestAnnouncement.GetLatestAnnouncement(Boolean showFullText) +610
    Test.Sharepoint.AppWeb.Pages.LatestAnnouncement.Page_Load(Object sender, EventArgs e) +764
    System.Web.UI.Control.LoadRecursive() +71
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
    Impreza Software Development

    Hi GuYumming,
    I have checked the Sharepoint site using Fiddler and my X-SharePointHealthScore stays consistently on 1, I have even refreshed the site and had the "(429) Too Many Requests" error happen right in front of me whilst Fiddler is running and when I look at the
    200 response for the Sharepoint site it is still showing "X-SharePointHealthScore: 1".
    I assume because of this I do not need to make any of the changes suggested in your article above?
    I have also been through the ULS logs and found the following 3 log entries that appear to relate to the issue but they do not really mean much to me so I am hoping that you can help:
    Begin CSOM Request ManagedThreadId=59, NativeThreadId=12476
    SPResourceTally(ClientServiceRequestDuration) value 1 + 150425 > 150000
    ResourceBudgetExceeded, sending throttled status code. Exception=Microsoft.SharePoint.SPResourceBudgetExceededException: ResourceBudgetExceeded     at Microsoft.SharePoint.SPResourceTally.Check(Int32 value)    
    at Microsoft.SharePoint.SPAggregateResourceTally.Check(SPResourceKind kind, Int32 value)     at Microsoft.SharePoint.Client.SPClientServiceHost.OnBeginRequest()
    Impreza Software Development

  • ASMX web service and The remote server returned an error: (500) Internal Server Error issue

    i have developed a very small web service and which is hosted along with our web site. our webservice url is
    http://www.bba-reman.com/Search/SearchDataIndex.asmx
    web service code
    namespace WebSearchIndex
    #region SearchDataIndex
    /// <summary>
    /// SearchDataIndex is web service which will call function exist in another library for part data indexing
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    // [System.Web.Script.Services.ScriptService]
    public class SearchDataIndex : System.Web.Services.WebService
    //public AuthHeader ServiceAuth=null;
    public class AuthHeader : SoapHeader
    public string Username;
    public string Password;
    #region StartIndex
    /// <summary>
    /// this function will invoke CreateIndex function of SiteSearch module to reindex the data
    /// </summary>
    [WebMethod]
    public string StartIndex(AuthHeader auth)
    string strRetVal = "";
    if (auth.Username == "Admin" && auth.Password == "Admin")
    strRetVal = SiteSearch.CreateIndex(false);
    else
    SoapException se = new SoapException("Failed : Invalid credentials",
    SoapException.ClientFaultCode,Context.Request.Url.AbsoluteUri,new Exception("Invalid credentials"));
    throw se;
    return strRetVal;
    #endregion
    #endregion
    when i was calling that web service from my win apps using
    HttpWebRequest
    class then getting error The remote server returned an error: (500) Internal Server Error
    here is code of my win apps from where i am calling web service
    string strXml = "";
    strXml = "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><StartIndex xmlns='http://tempuri.org/' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'><auth><Username>joy</Username><Password>joy</Password></auth></StartIndex></s:Body></s:Envelope>";
    string url = "http://www.bba-reman.com/Search/SearchDataIndex.asmx";
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
    req.Method = "POST";
    req.ContentType = "text/xml";
    req.KeepAlive = false;
    req.ContentLength = strXml.Length;
    StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
    streamOut.Write(strXml);
    streamOut.Close();
    StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
    string strResponse = streamIn.ReadToEnd();
    streamIn.Close();
    i am just not being able to understand when this line execute
    StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
    then getting the error The remote server returned an error: (500) Internal Server Error
    not being able to understand where i made the mistake. mistake is in the code of web service end or in calling code?
    help me to fix this issue. thanks

    Hi Mou,
    I just tried your win app code about calling web service, but failed. I got the 500 error after I called your service:
    The error message I quoted from Fiddler:
    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>System.Web.Services.Protocols.SoapException: Failed : Invalid credentials ---&gt; System.Exception: Invalid credentials
    --- End of inner exception stack trace ---
    at BBAReman.WebSearchIndex.SearchDataIndex.StartIndex(AuthHeader auth)</faultstring><faultactor>http://www.bba-reman.com/Search/SearchDataIndex.asmx</faultactor><detail /></soap:Fault></soap:Body></soap:Envelope>
    I am not totally sure that error occurred by the authentication. But I suggest you can try to add this service into your project using this method below:
    1.right click the Reference and select Add Service Reference
    2.input your service link and click "Go"
    And you can use this service as the following:
    private async void callService()
    ServiceReference1.SearchDataIndexSoapClient client =new ServiceReference1.SearchDataIndexSoapClient();
    var Str= await client.StartIndexAsync(new ServiceReference1.AuthHeader { Username = "Admin", Password = "Admin" });
    Please try it.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Getting "The remote server returned an error 503 server unavailable" in azure web jobs

    I have created one web
    job - on demand schedule under azure web site.  This web jobs contains .execmd(i.e.)
    Console Application.
    I am retrieving the data from SQL Azure database and uploaded the data in sharepoint online lists. (i.e.)I have uploaded the data to several(7) lists in each subsites. I have 3 subsites. 
    I am getting this error "The remote server returned an error 503 server unavailable", while uploaded the data into lists. 
    Full Error Message:
    Message - The remote server returned an error 503 server unavailable.
    StackTrace -    at System.Net.HttpWebRequest.GetResponse()
    > cc525c: INFO]    at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
    > cc525c: INFO]    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
    > cc525c: INFO]    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
    > cc525c: INFO]    at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
    > cc525c: INFO]    at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
    This is not occur every time. Some time i didn't get any error data successfully uploaded in share point online list.
    Totally 4 hours taken uploaded the data into list for completed all 3 subsites. 
    If anyone know how to resolve this.
    Thanks,
    A.Ramu

    Hi,
    Per my understanding, there is an issue when uploading data from SQL Azure database to a SharePoint list in Online environment.
    For narrowing down the issue, I suggest you create a Console Application in Visual Studio without accessing the SQL Azure database and upload some sample data to the same SharePoint
    list to see if the issue still occurs intermittently.
    Thanks
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Power BI analysis services connector - the remote server returned an error (403)

    Hi all, does any one have any suggestions what to try to identify the configuration problem I have?
    I have, a SSAS 2012 tabular instance with SP2, there is a database on the instance with a read role with everyone assigned permissions. 
    When configuring the Power BI analysis services connector, at the point where you enter Friendly Name, Description and Friendly error message, when you click next I receive the error "The remote server returned an error (403)." 
    I've tested connecting to the database from Excel on a desktop and connect fine.
    I don't use a "onmicrosoft" account so don't have that problem to deal with.
    We use Power BI Pro with our Office 365. As far as I can tell that part is working ok as I pass that stage of the configuration with a message saying connected to Power BI.
    The connector is installed on the same server as tabular services, its a Win2012 Standard server. The tabular instance is running a domain account that is the admin account for the instance (this is a dev environment) that account is what I've used in the
    connector configuration. It's also a local admin account. There is no gateway installed on the server.
    Any help would be greatly appreciated, thanks, Brian
    Brian Searle

    Brian-
    One other common issue I've seen is the UPN not quite matching. Log onto the SSAS server as the user who's logged into Power BI. Then open a command prompt and run:
    whoami /upn
    Hopefully the UPN it says will match your EffectiveUserName test and will match exactly how you're signing into the Power BI site.
    If that doesn't work, your best bet is to go to
    http://support.powerbi.com/ and click Contact Support and describe this situation and someone from the Power BI support team should get in touch with you to troubleshoot.
    http://artisconsulting.com/Blogs/GregGalloway

  • The remote server returned an error: (401) Unauthorized

    We are attempting to upload a file to SharePoint on Office 365 and get the following error:
    The remote server returned an error: (401) Unauthorized.
    We also tried using NetworkCredentials and that got the following error: The remote server returned an error: (404) Not Found.
    The code is shown below.
    Any idea on to fix this error?
    public
    void uploadDocument(string
    siteurl, string username,
    SecureString securepassword,
    string domain,
    string filestreamPath =
    "NewDocument.docx",
    string serverRelativeUrl =
    "/Shared Documents/NewDocument.docx")
    ClientContext context =
    new
    ClientContext(siteurl);
            //context.Credentials = new NetworkCredential(username, securepassword, domain);
    context.Credentials = new
    SharePointOnlineCredentials(username, securepassword);
    using (FileStream
    fileStream =
    new
    FileStream(filestreamPath,
    FileMode.Open))
    ClientOM.File.SaveBinaryDirect(context,
    serverRelativeUrl, fileStream, true);

    Yes, it has access.  In fact, it has no problem getting the site properties using the code below.  It is just when I am uploading a file that the error occurs.
    public Web getProperties(string
    siteurl, string username,
    SecureString securepassword)
    Web web = null;
    // Starting with ClientContext, the constructor requires a URL to the
    // server running SharePoint.
    ClientContext context = new ClientContext(siteurl);
    // The SharePoint web at the URL.
    web = context.Web;
    // We want to retrieve the web's properties.
    context.Load(web);
    // Execute the query to the server.
    context.Credentials = new SharePointOnlineCredentials(username, securepassword);
    context.ExecuteQuery();
    return web;

  • Risport Service: The remote server returned an error: (502) Bad Gateway

    Hi All.
    I am using the CUCM (System version: 6.1.3.2000-1) Risport function to get device information.
    When trying to connect to the service (https://<CUCM_IP>:8443/realtimeservice/services/RisPort) I receive the folowing error:
    The remote server returned an error: (502) Bad Gateway
    When entering the same URL into the browser on the same application server I get a Security Alert, user prompt and eventually the expected screen. So the service is running, but somhow I can not connect to it using the application.
    Does anyone know how to solve this?
    Thanks in advance

    It is an C#.NET Windows Service.
    I have solved "the problem". The service was running with "local system account". That user did not had the right proxy rights to connect to the CUCM service.
    So I changed the Windows Service user to the account that I use to login on that machine (with the right proxy rights) and now it is working ;-)
    I figured this out because when I logged into that machine, with my account, I could connect to the CUCM service without any problems with my browser.

Maybe you are looking for

  • Query only form problems

    I have a data block linked to a parent table in a parent/child relationship. The parent table's query key is made up of 2 data items. When the form is executed I want the users to enter values in these 2 data items and then press a button that has a

  • Cancellation document does not generate Accounting document

    Hi Experts,     I am facing an issue that when a Billing document is getting cancelled through workflow ,the billing document does not generate a accounting document .I tried debugging the issue to check it but could not find the root cause of the is

  • How can I add a third e-mail address to a submit button?

    Right now it's only limited to two addresses. The form in question is here: http://www.ucmexus.ucr.edu/resources/Final_Narrative_Report_CONACYT.pdf I need to add a third person to the existing addresses in the submit button. Using Acrobat X Pro.

  • Siri problem with my info changing

    I have an ipad 3 with IOS 6.  Mywife has an iphone 4s with IOS 6.  When I go into settings for siri and put my info in it shows up on my wife's phone.  If I change the info on her phone it changes the identity on my ipad.  How do I get them set and n

  • Flash Builder Premium (update data base method error)

    Hi, I've run into this error with Flash Premium when updating a data base. Evidently there is a glich in the auto generated code. I explain it in the second half of the video below. If you want the code you can download it from kshunter.wordpress.com