I have a web service that was created back in 2002 that sits hitting on a site that we've always used to run random things. For example, I have a operation that I pass in a local filename for importing a csv file for importing new products. I haven't run it in a little over a month, but today when I got a new file I tried running and every time I hit the invoke button I get
System.InvalidOperationException: Request format is invalid: .
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
I check the modified date of the asmx file and it hasn't been changed in 3 years. There's been several other changes to code elsewhere in the solution, so I assume something is broken there. I jump over to another project that doesn't have a modified date in newer than a year back and add
[WebMethod()]
public string HelloWorld()
{
return "Hello!";
}
[WebMethod()]
public string HelloWorldWithParam(string name)
{
return "Hello " + name;
}
If I invoke HelloWorld, I get the expected "Hello!" back. If I invoke HelloWorldWithParam, I get the same error. Note, in case you aren't sure what I mean by "Documentation" mode is, this might spark some memories.
This issue is only when parameters are being used on the Documentation mode. If I slap on a [ScriptMethod(UseHttpGet=true)] and call via http://localhost:57067/test.asmx/HelloWorldWithParam?name=Jason I get the proper <string xmlns="http://www.lenstock.com/app">Hello Jason</string> back. Same if I write some code to connect to the web service.
Did something happen in the recent .NET security updates or Visual Studio updates? How can I get the functionality back? It's going to be really annoying to have to move all of this stuff out elsewhere when we have all this documentation on how to do different things that we've been doing for two decades now.