Aspnetcore: Adding a WCF connected service crashes compiler

Created on 18 Apr 2018  路  5Comments  路  Source: dotnet/aspnetcore

When adding a service reference to a WCF service and then compiling the blazor webapp crashes the compiler. Got the following stacktrace.

1>Fatal error in IL Linker
1>Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Private.ServiceModel, Version=4.1.2.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1> at Mono.Linker.DirectoryAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
1> at Mono.Linker.AssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
1> at Mono.Linker.DirectoryAssemblyResolver.Resolve(AssemblyNameReference name)
1> at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
1> at Mono.Linker.Steps.ResolveFromAssemblyStep.ProcessLibrary(LinkContext context, AssemblyDefinition assembly, RootVisibility rootVisibility)
1> at Mono.Linker.Steps.ResolveFromAssemblyStep.ProcessLibrary(AssemblyDefinition assembly)
1> at Mono.Linker.Steps.ResolveFromAssemblyStep.Process()
1> at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
1> at Mono.Linker.Pipeline.Process(LinkContext context)
1> at Mono.Linker.Driver.Run(ILogger customLogger)
1> at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
1>C:\Users\.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targetsBlazor.MonoRuntime.targets(435,5): error MSB3073: The command "dotnet "C:\Users\.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets../tools/illink/illink.dll" -c link -u link -t --verbose -d "C:\Users\.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets../tools/mono/bcl/" -d "C:\Users\.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets../tools/mono/bcl/Facades/" -o "D:\Projects\Webclient\objDebug\netstandard2.0blazor/linker/" -x "C:\Users\.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targetsBuiltInBclLinkerDescriptor.xml" -x "D:\Projects\Webclient\objDebug\netstandard2.0blazor\linker.descriptor.xml" -a "C:\Users\.nuget\packages\microsoft.aspnetcore.blazor\0.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Users\.nuget\packages\microsoft.aspnetcore.blazor.browser\0.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Users\.nuget\packages\microsoft.extensions.dependencyinjection2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Users\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Users\.nuget\packages\system.buffers\4.4.0\lib\netstandard2.0\System.Buffers.dll" -a "C:\Users\.nuget\packages\system.net.http.winhttphandler\4.4.0\lib\netstandard2.0\System.Net.Http.WinHttpHandler.dll" -a "C:\Users\.nuget\packages\system.reflection.dispatchproxy\4.4.0\lib\netstandard2.0\System.Reflection.DispatchProxy.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.security.principal.windows\4.4.0\lib\netstandard2.0\System.Security.Principal.Windows.dll" -a "C:\Users\.nuget\packages\system.servicemodel.duplex\4.4.2\lib\netstandard2.0\System.ServiceModel.Duplex.dll" -a "C:\Users\.nuget\packages\system.servicemodel.http\4.4.2\lib\netstandard2.0\System.ServiceModel.Http.dll" -a "C:\Users\.nuget\packages\system.servicemodel.nettcp\4.4.2\lib\netstandard2.0\System.ServiceModel.NetTcp.dll" -a "C:\Users\.nuget\packages\system.servicemodel.primitives\4.4.1\lib\netstandard2.0\System.ServiceModel.Primitives.dll" -a "C:\Users\.nuget\packages\system.servicemodel.primitives\4.4.1\lib\netstandard2.0\System.ServiceModel.dll" -a "C:\Users\.nuget\packages\system.servicemodel.security\4.4.2\lib\netstandard2.0\System.ServiceModel.Security.dll" -a "D:\Projects\Webclient\objDebug\netstandard2.0\Webclient.dll"" exited with code 1.

area-blazor

Most helpful comment

Pretty sure WCF is not going to work anyway. You are restricted to requests via the browser, so basically only the HttpClient.

All 5 comments

Pretty sure WCF is not going to work anyway. You are restricted to requests via the browser, so basically only the HttpClient.

Is the WCF project a netstandard library? That is the only kind of project/package that is supported to reference for client side use.

@rvhelden If you can give repro steps I can validate whether this is meant to be supported.

Also @floreseken is correct. Much easier to build JSON web APIs.

It probably is, but was just trying the new blazor project and tried to connect it to one of our exisitng services.

Steps to reproduce:

  1. Create new blazor project
  2. Add a connected service
  3. Then build the project

You can use this file as wcf wsdl

<definitions name = "HelloService"
   targetNamespace = "http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns = "http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns = "http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns:xsd = "http://www.w3.org/2001/XMLSchema">

   <message name = "SayHelloRequest">
      <part name = "firstName" type = "xsd:string"/>
   </message>

   <message name = "SayHelloResponse">
      <part name = "greeting" type = "xsd:string"/>
   </message>

   <portType name = "Hello_PortType">
      <operation name = "sayHello">
         <input message = "tns:SayHelloRequest"/>
         <output message = "tns:SayHelloResponse"/>
      </operation>
   </portType>

   <binding name = "Hello_Binding" type = "tns:Hello_PortType">
      <soap:binding style = "rpc"
         transport = "http://schemas.xmlsoap.org/soap/http"/>
      <operation name = "sayHello">
         <soap:operation soapAction = "sayHello"/>
         <input>
            <soap:body
               encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"
               namespace = "urn:examples:helloservice"
               use = "encoded"/>
         </input>

         <output>
            <soap:body
               encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"
               namespace = "urn:examples:helloservice"
               use = "encoded"/>
         </output>
      </operation>
   </binding>

   <service name = "Hello_Service">
      <documentation>WSDL File for HelloService</documentation>
      <port binding = "tns:Hello_Binding" name = "Hello_Port">
         <soap:address
            location = "http://www.examples.com/SayHello/" />
      </port>
   </service>
</definitions>

Please see this: https://github.com/dotnet/wcf/issues/2349
This may be the reason...

Thanks again for letting us know. This isn't a scenario we want to target during the current phase, so I'll close it for now. Later on we may still decide that WCF service references should be supported, though it's likely that a plain JSON API is a much better way to go for most developers.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pixel-Lord picture Pixel-Lord  路  3Comments

guardrex picture guardrex  路  3Comments

ermithun picture ermithun  路  3Comments

aurokk picture aurokk  路  3Comments

Kevenvz picture Kevenvz  路  3Comments