How can an incorrect XML header (encoding) be changed on the fly in IIS before being processed by the WCF class?

I have a client sending a web request (POST) of XML data to a server. The XML chapter reads <?xml version="1.0" encoding="utf-16"?>, but the data is valid utf-8. We are trying to intercept an existing stream (and everyone involved understands this, we are trying to put-and-forward, so if there is downtime, we can at least buffer requests), but IIS seems to reject the XML, because the actual the encoding does not match the declared encoding.

If we manually (using the string as our initial value in the test client application) force the encoded stream stream and set the encoding value inside the string in UTF-32 or UTF-8 in C # and paste it into our WCF method, it works fine.

But, sending the header in the file that reads UTF-16 to the encoded values ​​of UTF-8, it starts. Finally, and most annoying, I am not the main developer of this, I had eyes for this for a total of 6 hours in 4 days, and now it is very difficult for me to find a spare piece of magic laying on. Does anyone have any ideas?

So, my problem is with IIS or ASP.NET, I understand this. I'm just not sure what and where to kick this damn thing, and I don’t know what details I don’t have enough for this question. I did hash this in the chat before posting here, and a few more details were discovered, but if you have questions, I can answer them as I can. You just ask what you want to see, and I will share. And I'm going to refuse to continue and host a lot of C # code and web.config, because, frankly, I don't know what the best starting point is for this particular problem.

So, there is no way to fix the header on the client side?

Not at this time. I just spent 30 minutes calling a group support, and their main developer for this project came out over the next 10 days, and our sales group promised our product by the end of this week.

, ?

. 400. , , . , - IIS ;)


,

  • ASP.NET IIS, , , , , tyvm, , OR
  • WCF , , " ", <?xml version="1.0" encoding="utf-16"?> .
+3
1
0

Source: https://habr.com/ru/post/1778859/


All Articles