请为我遇到的以下错误寻求帮助。每当我查询servicecontainer中存在的值时,它都可以正常工作。如果该值不存在,则会出现以下错误:
出现错误的代码行:
BusinessPartner bp = currentServiceContainer.BusinessPartners.Where(
c=> c.cn==cn).SingleOrDefault();
我正在使用.Net core 2.2
Thanks
System.PlatformNotSupportedException
HResult=0x80131539
Message=Secure binary serialization is not supported on this platform.
Source=System.Private.CoreLib
StackTrace:
at System.Exception.add_SerializeObjectState(EventHandler`1 value)
at System.Data.Services.Client.HttpWebRequestMessage.ConvertToDataServiceWebException(WebException webException)
at System.Data.Services.Client.HttpWebRequestMessage.GetResponse()
at System.Data.Services.Client.DataServiceContext.GetResponseHelper(ODataRequestMessageWrapper request, IAsyncResult asyncResult, Boolean handleWebException)
at System.Data.Services.Client.QueryResult.ExecuteQuery()
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
at System.Data.Services.Client.DataServiceQueryProvider.ReturnSingleton[TElement](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
at SAPB1Servicelayer.ServiceLayerService.GetBP(String cardCode) in C:\Programs\.Net\SAPB1Servicelayer\ServiceLayerService.cs:line 1320
at SAPB1ServicelayerAPI.Services.SAPB1ServiceLayerServices.GetBusinessPartner(String cardCode) in C:\Programs\.Net\SAPB1ServicelayerAPI\SAPB1ServicelayerAPI\Services\SAPB1ServiceLayerServices.cs:line 46
at SAPB1ServicelayerAPI.Controllers.BusinessPartnersController.Get(String cardCode) in C:\Programs\.Net\SAPB1ServicelayerAPI\SAPB1ServicelayerAPI\Controllers\BusinessPartnersController.cs:line 33
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()