简体   繁体   中英

ASP.NET Web service - 400 bad request

I have a web service that gets a string as parameter and returns string . This service is located on server1. On server2 I have a little (2 line) console application to test this web service and everything works ok. When I call the same web service (using the same settings - no settings, url is the same, everything about web service part is the same) I get "400 bad request" error. In the same function I have something like this:

using(var ctx = ClientContext(siteUrl)) //  sharepoint client object model
{
   using(var db = SomeEntitiesContext()) // entities context
   {
       ...
       var webservice = MyService.MyServiceClass();

       foreach(var item in items)
       {
           var res = webservice.MyMethod(myinput); //here I get 400 bad request error
       }
   }
}

Is it possible that other contexts have mixed up something? It's strange that a console based testing app is working.

It was something with the string that I get from DB vs hardcoded (the same string from DB)... I changed web service so it gets byte array insted of string and now it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM