简体   繁体   English

WCF REST服务返回错误:远程服务器返回错误:(400)错误的请求

[英]WCF REST Service returns Error :The remote server returned an error: (400) Bad Request

I have call Rest WCF Service from a project like below 我已经从以下项目中致电Rest WCF Service

 userAlias = "test";
                var url = new StringBuilder();
                url.Append(
                    string.Format("https://webdemo-t.orioninc.com:8443/Services/2012v2/TestService.svc/AddAttachment?User={0}&Engagement={1}&FileName={2}&DocumentTrasferID={3}&fileSize={4}&ActivityName={5}",userAlias, engagementName, fileName, documentTranferId, fileSize, activityName));
                WebRequest request = WebRequest.Create(url.ToString());
                CurrentUrl = url.ToString();
                var networkCredential = new NetworkCredential("jame", "test", "company");
                request.Credentials = networkCredential;
                WebResponse response = request.GetResponse();
                Encoding encoding = Encoding.GetEncoding(1252);
                var responseStream = new StreamReader(response.GetResponseStream());
                string responseResult = responseStream.ReadToEnd();
                responseStream.Close();
                Console.WriteLine(responseResult);

while calling these service i got exception The remote server returned an error: (400) Bad Request. 调用这些服务时,我得到了异常远程服务器返回错误:(400)错误的请求。 When i try to return a normal string in the WCH implementation method i got the webresponse result correctly.How can i resolve this error? 当我尝试在WCH实现方法中返回普通字符串时,我正确地获得了webresponse结果。如何解决此错误?

WCF Implementation Method WCF实施方法

  public string AddAttachment(string User, string Engagement, string FileName, string DocumentTrasferID, string fileSize, string ActivityName)
    {
        dynamic _Trackerfaccade = new KPMG.EauditEmailService.Facade.EAppEmail();
        string Result = _Trackerfaccade.AddAttachment(User, Engagement, FileName, DocumentTrasferID, fileSize, FileName);
        return Result;
    }

Operation Contract 经营合同

     [OperationContract]

   [WebGet(UriTemplate = "/AddAttachment?User={userAlias}&Engagement={engagementName}&FileName={FileName}&DocumentTrasferID={documentTranferId}&fileSize={fileSize}&activityName={activityName}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    string AddAttachment(string userAlias, string engagementName, string documentTranferId,string fileName,string fileSize,string activityName);
"/AddAttachment?User={0}&Engagement={1}&FileName={2}&DocumentTrasferID={3}&fileSize={4}&ActivityName={5}"

"/AddAttachment?userAlias={userAlias}&engagementName={engagementName}&documentTranferId={documentTranferId}&fileName={fileExtension}&fileSize={fileSize}&activityName={activityName}"

url pattern and real url are not same, your request can't found this method 网址格式和实际网址不相同,您的请求找不到此方法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WCF远程服务器返回错误400错误的请求 - WCF The remote server returned an error 400 bad request C#WCF“ System.Net.WebException:远程服务器返回错误:(400)错误的请求。” - C# WCF “System.Net.WebException: The remote server returned an error: (400) Bad Request.” HttpWebRequest-远程服务器返回错误:(400) Bad Request - HttpWebRequest-The remote server returned an error: (400) Bad Request 远程服务器返回错误:(400)错误的请求C# - The remote server returned an error: (400) Bad Request C# Oauth2:远程服务器返回错误:(400)错误的请求 - Oauth2: The remote server returned an error: (400) Bad Request WCF IIS服务文件流式传输远程服务器返回意外响应:(400)错误的请求。 - WCF IIS service file streaming The remote server returned an unexpected response: (400) Bad Request. Http Web请求远程服务器返回错误:(400)错误的请求。 Twitter时间轴 - Http web request The remote server returned an error: (400) Bad Request. twitter timeline WCF Rest JSON服务400错误请求 - WCF Rest JSON service 400 bad request 远程服务器返回错误“(400)错误的请求。 ContentType =” text / xml; charset = utf-8“ - The remote server returned an error“ (400) Bad Request. ContentType = ”text/xml; charset=utf-8" 远程服务器返回错误:(400) 错误请求。 api.reseller.world - The remote server returned an error: (400) Bad Request. api.reseller.world
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM