【发布时间】:2022-12-03 23:00:25
【问题描述】:
我正在尝试从 Azure 函数返回一个 XML 配置文件。配置被写入如下所示的字符串中。
xml = @"<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>";
然后我像这样归还它
return req.CreateResponse(HttpStatusCode.OK, xml.Replace("\r\n",""));
但是 HTTP 调用的结果是这样的
"
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>"
我如何摆脱封闭的引号?
【问题讨论】:
-
你试过
req.CreateResponse(HttpStatusCode.OK, xml, Configuration.Formatters.XmlFormatter)吗? -
Configuration.Formatters.XmlFormatter 来自哪个包?我的 VS 说使用 System.Configuration 但它没有 Formatters.XmlFormatter 的定义。