.NET Core 3.1 SOAP 平台不支持错误“不支持编译 JScript/CSharp 脚本" [英] .NET Core 3.1 SOAP platform not supported error "Compiling JScript/CSharp scripts is not supported"

查看:70
本文介绍了.NET Core 3.1 SOAP 平台不支持错误“不支持编译 JScript/CSharp 脚本"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Amadeus 提供的 WSDL 文件 (wsdl.zip).当尝试使用以下代码调用服务方法时,它抛出一个 System.PlatformNotSupportedException 说不支持编译 JScript/CSharp 脚本"

I am using a WSDL file (wsdl.zip) provided by Amadeus. When trying to call the service method using the below code, it threw a System.PlatformNotSupportedException saying "Compiling JScript/CSharp scripts is not supported"

public async Task<Fare_MasterPricerTravelBoardSearchResponse> SearchFlight(Session session,
            Fare_MasterPricerTravelBoardSearch searchData)
        {
            var _client = new AmadeusWebServicesPTClient();
            var result = await _client.Fare_MasterPricerTravelBoardSearchAsync(session, searchData);
            return result;
        }

这真的是工具还不支持的东西吗?

Is this really something that is not supported by the tool yet?

堆栈跟踪:

at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location)
   at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
   at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
   at System.ServiceModel.Description.XmlSerializerHelper.FromMappingsViaReflection(XmlMapping[] mappings, Type type)
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GenerateSerializers()
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GetSerializer(Int32 handle)
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerStub.GetSerializer()
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.MessageInfo.get_HeaderSerializer()
   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.AddHeadersToMessage(Message message, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
   at System.ServiceModel.Dispatcher.OperationFormatter.SerializeRequest(MessageVersion messageVersion, Object[] parameters)
   at System.ServiceModel.Dispatcher.ProxyOperationRuntime.BeforeRequest(ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime operation, Boolean oneway, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.Begin()
   at System.ServiceModel.Channels.ServiceChannel.BeginCall(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, TimeSpan timeout, AsyncCallback callback, Object asyncState)
   at System.ServiceModel.Channels.ServiceChannel.BeginCall(ServiceChannel channel, ProxyOperationRuntime operation, Object[] ins, AsyncCallback callback, Object asyncState)
   at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.CreateGenericTask(ServiceChannel channel, ProxyOperationRuntime operation, Object[] inputParameters)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at SkywayTravel.Amadeus.Air.MasterPricerTravelBoardSearchClient.<SearchFlight>d__1.MoveNext() in E:MobileAppTelligenceProjectsSkywayTravelSkywayTravel.Amadeus.AirMasterPricerTravelBoardSearchClient.cs:line 29

推荐答案

由于您已经将问题发布到 Github 存储库,所以我在这里只是为了将解决方案的快照分享给其他人.
Microsoft WCF Web 服务参考生成的类型有问题提供者工具.
正如 shmao 所说,

As you have already posted the issue to Github repository, I am here just for sharing the snapshot of the solution for others.
There is something wrong with the generated type by Microsoft WCF Web Service Reference Provider tool.
As shmao said,

属性是一个二维数组,但是XmlArrayItemAttribute将项目类型指定为 typeof(ListViewRecordColumn).上班围绕这个问题,我们可以将项目类型更改为typeof(ListViewRecordColumn[]).

The property is a 2-dimensional array, but the XmlArrayItemAttribute specified the item type as typeof(ListViewRecordColumn). To work around the issue, we can change the item type to typeof(ListViewRecordColumn[]).

即更改**:

/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Order=5)]
** [System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn), IsNullable=false)]
public ListViewRecordColumn[][] records
{
    get
    {
        return this.recordsField;
    }
    set
    {
        this.recordsField = value;
    }
}

致:

[System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn[]), IsNullable=false)]

详情请
https://github.com/dotnet/wcf/issues/2219

这篇关于.NET Core 3.1 SOAP 平台不支持错误“不支持编译 JScript/CSharp 脚本"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆