問題タブ [xmlexception]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - xml ファイルを UTF-16 エンコーディング形式でデシリアライズ中に XmlException が発生する
C# の XmlSerializer を使用します。
特定のフォルダー内のすべての xml ファイルを逆シリアル化する過程で、XmlException
"There is an error in XML document (0, 0)".
と InnerException が"There is no Unicode byte order mark. Cannot switch to Unicode".
表示されます。ディレクトリ内のすべての xml は "UTF-16" でエンコードされています。唯一の違いは、一部の xml ファイルには、逆シリアル化中に使用しているオブジェクトのクラスで定義されている要素が欠落していることです。
たとえば、フォルダーに 3 種類の xml があるとします。
file1.xml
file2.xml
file3.xml
上記のxmlを表すクラスがあります:
次のスニペットは、私のために逆シリアル化を行います:
何か不足していますか?UTF-16 を UTF-8 に手動で置き換えようとすると、問題なく動作するように見えるため、エンコード形式を使用する必要があります。
load - ヘッドにバージョン 1.1 のドキュメントからの XDocumetn.Load で XmlException が発生する
文字列変数「xml」にxmlがあります
XDocument を取得してみます。
System.Xml.XmlException. バージョン番号 1.1 は許可されていません。
azure - Azure, MVC Core Web App suddenly throw "XmlException: Root element is missing" + "CryptographicException"
I have a web application hosted by an Azure App service. It has worked fine for years but suddenly I get an Exception when i try to enter the Account/login action:
-->"XmlException: Root element is missing" + "CryptographicException: An error occurred while trying to encrypt the provided data.".
If i got to Home/About action (which have [AllowAnonymous]
attribute) that page works fine.
But if i try to enter a page within the Account controller which have the [AllowAnonymous]
attribute. That also throw the same Exception. So I am guessing the Exception occur in the constructor for the Account controller. See below.
I have not made any updates to the page in months and it has worked fine until now. If I run the application locally on my PC (connected to the same database on azure) it works fine. As I understand Azure have recently made updates to their portal. My guess is that the cause of the error is related to that.
Does anyone know how to solve this?