ASP.NET Core 2.0 Could not load file or assembly System.ServiceModel

前端 未结 2 1505
梦毁少年i
梦毁少年i 2021-01-07 20:16

I am working on porting an \"ASP.NET Core Web Application\" that was compiling under the .NET Framework 4.6.1 (i.e. full framework) over to compiling against .NET Core 2.0.

相关标签:
2条回答
  • 2021-01-07 20:33

    I solved this problem installing the Nuget package:

    Install-Package Microsoft.Windows.Compatibility
    

    I was using ASP.net Core 2.2 but maybe works for 2.0v too

    0 讨论(0)
  • 2021-01-07 20:41

    In Asp.Net Core, when the Microsoft WCF Web Service Reference Provider is used under the connected services, code generator automatically includes System.ServiceModel.Duplex, System.ServiceModel.Http, System.ServiceModel.NetTcp, System.ServiceModel.Security'assemblies.

    <PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.Http" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.Security" Version="4.4.*" /> 
    

    In your occasion, System.ServiceModel.Primitives is needed to be added aswell. System.ServiceModel.Primitives assembly includes System.ServiceModel.dll

    System.ServiceModel, Version=4.0.0.0 is not used anymore.

    please also see: https://github.com/dotnet/standard/issues/575#issuecomment-380479584

    0 讨论(0)
提交回复
热议问题