我试图在Asternet中为我的GeneralMappingStrategy使用XML。我的程序运行良好,使用列表
例如:
agiServer.MappingStrategy = new GeneralMappingStrategy(
new List<ScriptMapping>()
{
new ScriptMapping() {
ScriptName = "testIVR",
ScriptClass = "Asterisk_Test.testIVR",
}
});但是我宁愿让它像它在文档中说的那样读取一个XML文件,但是它似乎并没有说明XML格式需要什么。
我试过:
string pathtoxml = "test.xml";
agiServer.MappingStrategy = new GeneralMappingStrategy(pathtoxml);使用我的XML作为:
<?xml version="1.0"?>
<ScriptMapping>
<ScriptName>testIVR</ScriptName>
<ScriptClass>Asterisk_Test.testIVR</ScriptClass>
</ScriptMapping>作为一个完全的猜测,似乎是有意义的,但这不能编译,我得到了以下错误:
'System.Collections.Generic.List`1AsterNET.FastAGI.MappingStrategies.ScriptMapping'.‘:“有一个反映类型System.InvalidOperationException的错误
有人知道怎么做吗?
发布于 2017-04-28 09:50:10
看来Aster.NET库有问题,我现在已经提交了修复程序,并且已经被接受了。对于将来在这方面有问题的任何人,XML格式是:
<?xml version="1.0"?>
<ArrayOfScriptMapping xmlns:xsi="w3.org/2001/XMLSchema-instance"; xmlns:xsd="w3.org/2001/XMLSchema">
<ScriptMapping>
<ScriptName>testIVR</ScriptName>
<ScriptClass>Asterisk_newTest.testIVR</ScriptClass>
</ScriptMapping>
</ArrayOfScriptMapping> https://stackoverflow.com/questions/43640030
复制相似问题