After reading documentation and forums, I saw that the problem is generated because I'm using an await inside an OperationContextScope
. I'm using ASP.NET Core 6 MVC and C#.
The problem is that the code is replicated in two different applications, literally they have the same code, but in one I have the OperationContextScope
error and in the other one not.
using (new OperationContextScope(client.InnerChannel))
{
SoapAuthenticationHeader.Create(client.ClientCredentials.UserName.UserName,
client.ClientCredentials.UserName.Password);
zWsGetList = CreateZWSGetListObject(param);
var GetListResponse1 = await client.GetListAsync(zWGetList);
// Rest of the code
}
I used breakpoints but it breaks after when it exits the breakpoint.
Sorry if I'm wrong in something that may be a rookie, but it seems very strange to me that in one application it works perfectly and in the other it doesn't, and both of them are EXACTLY the same. Maybe is a nuget package?
I installed this NuGet and it finally worked:
System.ComponentModel.Annotations
System.Configuration.ConfigurationManager
System.ServiceModel.Duplex
System.ServiceModel.Federation
System.ServiceModel.Http
System.ServiceModel.NetTcp
System.ServiceModel.Security
Some of them came by default, other I had to install manually. Hope You find this usefull.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.