The remote server returned an error: (405) Method Not Allowed.
Hello
I wrote this code for search in Google and retrieved the result. But I have the error on Bold part of the code.
I got this code from: http://revenmerchantservices.com/post/2009/05/26/HttpWebRequest-Post-method.aspx
private void button1_Click(object sender, EventArgs e)
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.google.com/?gws_rd=ssl");
request.Timeout = 9 * 1000; // set request timeout = 9 second. if yahoo api failed to respond in 9 second request would get timed out.
request.Method = "Post"; // we will post the data using post method
//string postData = "u=" + TextBox1.Text + "&m=s&t=8";
string postData = "u=" + "My Search data" + "&m=s&t=8";
// data to be posted using HttpWebrequest post method
// we will post parameter u , m and t
// Convert this string into stream of bytes
byte[] arrPostDAta = System.Text.Encoding.GetEncoding("utf-8").GetBytes(postData);
// set request content length = post data length
request.ContentLength = arrPostDAta.Length;
System.IO.Stream strmPostData = request.GetRequestStream();
// get request stream
// write post data to stream of request
strmPostData.Write(arrPostDAta, 0, arrPostDAta.Length);
strmPostData.Close();
// upload post data and Get Response from server
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
label1.Text = reader.ReadToEnd();
reader.Close();
response.Close();
I found a code and do not have such an error: http://stackoverflow.com/questions/25339401/perform-a-search-on-google-and-retrieve-results-on-second-page
private void button2_Click(object sender, EventArgs e)
string uriString = "http://www.google.com/search";
string keywordString = "Site:www.amazon.com Handbook";
WebClient webClient = new WebClient();
NameValueCollection nameValueCollection = new NameValueCollection();
nameValueCollection.Add("q", keywordString);
webClient.QueryString.Add(nameValueCollection);
richTextBox1.Text = webClient.DownloadString(uriString);
richTextBox1.SaveFile(Application.StartupPath+@"\x.txt");
But how can I get a URL from the result?
Similar Messages
-
UPK 11.1 installation error "(405) Method Not Allowed"
Hi
While assisting a customer to install UPK 11.1 I encountered an issue and a Libraryloader log was generated
System of the client to install UPK 11.1 on is
- Virtuele machine W2008 x64 R2
- Separate sql cluster for the databases
Both machines are in the same domain!
2012-12-14 15:18:36 INFO Application started
2012-12-14 15:18:36 INFO Command line: "C:\Program Files (x86)\User Productivity Kit\UPK Developer 11_1Server\LibraryLoader.exe" "C:\install\Oracle UPK\V30865-01\UPK_Pro_v11.1.0" "/librarylocation:http://vupk:80/UPKDevcontent" /language:NL /producttier:Server /branding:UPK /overwrite:no /update:no /authenticationtype:windowscurrent
2012-12-14 15:18:36 INFO Source path: C:\install\Oracle UPK\V30865-01\UPK_Pro_v11.1.0
2012-12-14 15:18:36 INFO Library location: http://vupk:80/UPKDevcontent
2012-12-14 15:18:36 INFO Language: NL
2012-12-14 15:18:36 INFO Product tier: Server
2012-12-14 15:18:36 INFO Branding: UPK
2012-12-14 15:18:36 INFO Overwrite: False
2012-12-14 15:18:36 INFO English only: False
2012-12-14 15:18:36 INFO Options:
2012-12-14 15:18:36 INFO Import system documents: True
2012-12-14 15:18:36 INFO Copy files: True
2012-12-14 15:18:36 INFO Authenticate only: False
2012-12-14 15:18:36 INFO Authentication type: windowscurrent
2012-12-14 15:18:36 INFO User name:
2012-12-14 15:18:36 INFO Password: ***
2012-12-14 15:18:36 INFO Update: False
2012-12-14 15:18:36 INFO Loading documents in Server - Client environment
2012-12-14 15:18:36 INFO Authenticate by Windows authentication
2012-12-14 15:18:36 ERROR Gkn.OnDemand.Library.OfflineException:
at Gkn.OnDemand.Library.LibraryComponent.AuthenticateProfile(IUserProfile userProfile) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\LibraryComponent\LibraryComponent.cs:line 388 at Gkn.OnDemand.Library.LibraryComponent.Run(String command) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\LibraryComponent\LibraryComponent.cs:line 264 at Gkn.OnDemand.ComponentModel.ApplicationCore.Run(String bootComponentId, String command) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\ComponentModel\AppCore.cs:line 154 at Gkn.OnDemand.ComponentModel.Application.Run(String bootComponentId, String command) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\ComponentModel\Application.cs:line 538
InnerException:
Gkn.OnDemand.Library.LibraryConnectionException: There is a problem with the server configuration. See your system administrator with the following information.
at Gkn.OnDemand.Library.RemoteRepositoryStrategy.GetLibraryInfo(IUserProfile userProfile) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\LibraryComponent\RemoteRepositoryStrategy.cs:line 98 at Gkn.OnDemand.Library.LibraryService.GetLibraryInfo(IUserProfile userProfile) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\LibraryComponent\LibraryService.cs:line 290 at Gkn.OnDemand.Login.LoginService.Authenticate(IUserProfile userProfile, Boolean login) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\LibraryComponent\Login\LoginService.cs:line 183
InnerException:
System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method Not Allowed.
Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Gkn.OnDemand.Service.Content.RepositoryInfoServiceReference.IRepositoryInfoService.GetLibraryInfo() at Gkn.OnDemand.Library.RemoteRepositoryStrategy.GetLibraryInfo(IUserProfile userProfile) in e:\BUILDROOT_SUN\Builds\Branches\Hacienda\tfs\Core_DotNet\LibraryComponent\RemoteRepositoryStrategy.cs:line 91
InnerException:
System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Would it be possible to have a SQL/IIS configuration plan that we can share with a customer and have in this plan the minimum requiremnts regarding settings and autorisations?
I suspect there is something wrong with their SQL or IIS settings however I didn't succeed to determine that.
Or if their is a possibility to share their settings here and get feedback on that to solve the issue?The "Method Not Allowed" message is a very common message, meaning that there are problems in GET/POST actions.
To answer your question about teh basic IIS configuration:
The Roles must include IIS default features and under IIS Authentication you must enable Windows Based authentication if you plan to use this. If you plan to use forms authenticaton you don't need this option under the IIS Role. In that case the basic authentication is fine.
Under Features I recommend also to set teh option on for ASP.NET and especially the option for WCF activation. Without it might also work, but this installs the .Net framework properly. Then install UPK 11 and let UPK install .Net framework 4.
If you installed .Net framework 4 manually, make sure it is registered properly, for example with the command: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir -
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 -
static class StorageUtils
public static CloudStorageAccount StorageAccount
get
string account = ConfigurationManager.AppSettings["StorageAccountName"];
//string account = CloudConfigurationManager.GetSetting("StorageAccountName");
//string key = CloudConfigurationManager.GetSetting("StorageAccountAccessKey");
string key = ConfigurationManager.AppSettings["StorageAccountName"];
string connectionString = String.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", account, key);
return CloudStorageAccount.Parse(connectionString);
I have a web project and I converted it to "MS Azure Cloud Service Project"
I make the Azure project default and run CreateAndConfigureAsync() to create the container. It works fine and creates the images container in Azure storage.
Then I make my web project default and change CloudConfigurationManager.GetSetting to ConfigurationManager.AppSettings in StorageUtils class and run the web app project. Then I get "The remote server returned an error: (403) Forbidden" error whencontainer.CreateIfNotExistsAsync()
line get executed.
What is the reason for this?
async public void CreateAndConfigureAsync()
try
CloudStorageAccount storageAccount = StorageUtils.StorageAccount;
// Create a blob client and retrieve reference to images container
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("images");
// Create the "images" container if it doesn't already exist.
if (await container.CreateIfNotExistsAsync())
// Enable public access on the newly created "images" container
await container.SetPermissionsAsync(
new BlobContainerPermissions
PublicAccess =
BlobContainerPublicAccessType.Blob
catch (Exception ex)
}Hi,
It seems there is something wrong with your code, from your code the account and key are the same, because their appsetting name are the same.
string account = ConfigurationManager.AppSettings["StorageAccountName"];
//string account = CloudConfigurationManager.GetSetting("StorageAccountName");
//string key = CloudConfigurationManager.GetSetting("StorageAccountAccessKey");
string key = ConfigurationManager.AppSettings["StorageAccountName"];
string connectionString = String.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", account, key);
return CloudStorageAccount.Parse(connectionString);
If you use CloudConfigurationManager.GetSetting, please consider set azure project as the startup project, if not, this value will be null, this resulted in solution being started as a web project that didn't run inside the Azure emulator. Since CloudConfigurationManager.GetSetting
tries to get setting by contacting Azure (or Azure emulator in this case), and it is not running, it returns null.
Best Regards,
Jambor
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. -
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 wrongHi ,
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 -
Hi,
We are trying to deploy the provider hosted app in server environment . we are getting the "The remote server returned an error :(401) unauthorized" error after deploy the app in server.
stack Trace:
[webException:Te remote server returned an error:(401) UnAuthorized.]
System.Net.HeepWebRequest.GetResponse().
Followed the same MSDN steps , but sill same error. We have attached the certificate and using the same issuer ID in the app web.config.
Verified the IIS setting and still getting the same error when we call the "Clientcontext.ExecuteQuery()" method.
Same code is working fine in my Local dev environment.
If anyone have idea about this issue, please let me know.
Thank you,
MylsamyHi ,Thank you for your response. We have tried all the options and everything is same (Client ID,Issuer ID...etc) and finally figured out the issue.The below link saved my day.http://msdn.microsoft.com/en-us/library/office/dn762439(v=office.15).aspxIn "TokenHelper.cs" GetRealmFromTargetUrl method always return null andWhen we analyze the issue we found some variable name assigned for "Realm" Instead of GUID in SP server.Power shell command to get the Realm in SP server: Get-SPAuthenticationRealmWe have followed below article to generate the new GUID for realm.http://technet.microsoft.com/en-us/library/jj219756(v=office.15).aspx$c =Get-SPServiceContext -Site "http://<websiteurl>"Set-SPAuthenticationRealm -ServiceContext $c -Realm "a686d436-9f16-42db-09b7-cb578e110ccd".
Thankyou,Mylsamy -
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. -
Hi
I configured forms based authentication mode in Sharepoint 2013 site. When i tried to log in with windows authentication prompt it throws the following error
The remote server returned an error: (500) Internal Server Error
[WebException: The remote server returned an error: (500) Internal Server Error.] System.Net.HttpWebRequest.GetResponse() +8548300 System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +111 [ProtocolException:
The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+msbin1). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first
1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
How to fix this issue?
Regards,
SivaDid you create a new web application or modify an existing web application?
I would start by checking the ULS logs, maybe there is an incorrect setting within one of the web.config files, or SQL permissions.
Also, as suggested above, check application pools are running.
This blog post is a great guide for setting up FBA, check it through to make sure you haven't missed any steps:
http://blogs.technet.com/b/ptsblog/archive/2013/09/20/configuring-sharepoint-2013-forms-based-authentication-with-sqlmembershipprovider.aspx -
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. thanksHi 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 ---> 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. -
Hi I have a problem
The remote server returned an error: 227 Entering Passive Mode (201,199,193,165,154,52).
I dont knoe how to solve itHi,
Please see the following links and try the methods to check if they are helpful:
http://geekswithblogs.net/hmloo/archive/2012/10/16/the-remote-server-returned-an-error-227-entering-passive-mode.aspx
http://social.msdn.microsoft.com/Forums/en-US/0128e595-c8e2-4f5e-9426-fd93eb510cab/the-remote-server-returned-an-error-227-entering-passive-mode-67228534212130?forum=netfxnetcom
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
Then, it is not a Microsoft Office issue, you'd better post your question to MSDN forum:
http://social.msdn.microsoft.com/Forums/en-US/home?forum=netfxnetcom
Regards,
George Zhao
TechNet Community Support -
error while executing script for sharepoint online (office 365) - the remote server returned an error: (503) server unavailable.
I am creating many site collections reading records from sharepoint list using powershell in sharepoint online tenant (office 365).
Few site collections are created and then getting above error so this error record will be skipped then few succeeding record processed then again getting error.
pattern is like:
success
success
success
success
Error
success
success
success
success
success
success
error
successHi,
As it is an online environment, to troubleshoot this issue in an easier way, I suggest you contact Office 365 Support to see if there is any useful information in
the log files in the server side:
https://support.office.com/en-us/article/Contact-Office-365-for-business-support-32a17ca7-6fa0-4870-8a8d-e25ba4ccfd4b?ui=en-US&rs=en-US&ad=US
Best regards
Patrick Liang
TechNet Community Support -
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 SearleBrian-
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 -
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.RamuHi,
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] -
Hello,
I have a lightswitch web-application in development, which I need to copy from one computer to the other. I have tried doing it both through Git and by simply copying the solution and opening the project on another machine. The project builds without errors,
but when I try to debug it, it opens a web-browser, loads to 100% and pops up an error - Load operation failed for query 'GetAuthenticationInfo'. The remote server returned an error: NotFound.
Now, I have tried repairing Visual Studio on my machine, reinstalling .NET framework and setting <basicAuthentication enabled="false" /> in web.config, yet it still does not run.
When using Fiddler, it shows an error while loading the application - "HTTP/1.1 500 Internal Server Error" , which I honestly don't know what it means.
The application uses ComponentOne and Telerik modules, but they are both installed on both machines.
The application does run perfectly on the original machine, but it is not working on any other one.
Both machines are using Win 8.1 and Visual Studio 2013 Update 4.
I have tried to look this up online, but most people's problem are when they are deploying the app, not just debugging. I would be really happy for any help with this issue.
Thanks!I have the same problem on one of my development machines. Whenever I create a new project, the System.IdentityModel.Tokens.Jwt nuget package is not referenced properly. The project compiles correctly but you are not able to debug as I get the same error
as you.
If you open up your references and there is an error next to any of your references make sure that you correct them. In the case of the jwt reference error, I have to remove the jwt reference and then add it back from the packages folder.
This may not be your problem but could point you in a direction? -
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;
Maybe you are looking for
-
Getting error while running a new custom page form JDeveloper 9i
Hi, I am getting below error while running the custom page from JDeveloper 9i. Please not that, I have a DBC file and in the Connection whizard, I was able to successfully create DB connection. Any help would be appreciated. Exception Details. oracle
-
Content on ATV Disappears and Reappears without Syncing
The content on my Apple TV has been disappearing and reappearing without syncing. I have also been having the "firewall port 3689", "ATV not showing up in iTunes", and "this video format is not recognized/can't be played" errors. What is going on? Th
-
Is Apple TV able to connect to more then one tv
I was wanting to get Apple TV but I have 3 TVs can I connect Apple TV to all of them or do I have to buy a seaprate Apple TV for each tv.
-
Reg: Downloading and Uploading Date from Oracle Forms11g to Excel
Hi All, We are migrating to Oracle Forms11g from oracle forms6i , i need to knwo how the Report can be generated in 11g to Ecxel . For Uploading and Downloading. Please suggest any idea and suggestions. Thanks in Advances Gunisetty Venkatesulu
-
Hi, I have a version of CS4 on my Mac. I can not longer open Raw files with it from my Canon 5D. I never had problems with it in the past. What can I do?