0
votes

I have a web service written on WCF. I am trying to generate the client by using "Microsoft WCF Web Service Reference Provider". My project is .net core 3 web api. But I get this error Warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Could not load type 'System.Web.PreApplicationStartMethodAttribute' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='ILiveViewService']

Why is it trying to reference System.Web? It is a framework library. It is not part of the CORE

1

1 Answers

0
votes

I had the same problem, trying to include a new WCF, but it didn't work, with the same error above.

The conflict was between the references System.Web and Microsoft.AspNetCore.Mvc, probably when adding. It was giving conflict between both.

The solution was to remove any references from System.Web that I had on my controller.

Controller with error:

[ApiController]
public class TesteController: ControllerBase {}

Controller without error:

public class TesteController: Controller {}