0

We are attempting to use System.ServiceModel.dll to enact calls on our WCF web service. Our app builds and deploys OK but at runtime the following error is generated..

System.MissingMethodException: The method 'System.Void System.ServiceModel.BasicHttpBinding::.ctor()' has no implementation.

The application is built with System.ServiceModel.dll located in Assets/Plugins/WSA/x86/ and configured to be used on the Hololens platform (WSAPlayer) as seen below. How to address missing method exception?

We tried using different variations of System.ServiceModel.dll available at "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework" and "C:\Program Files\Unity\Editor\Data\" with no luck. Unsure how this error started as our application used to work without complication.

unitydllconfiguration

Client calling code

#if !UNITY_EDITOR
public static Service1Client client;
#endif

void Awake()
{
#if !UNITY_EDITOR
    client = new Service1Client(new BasicHttpBinding(),
        new EndpointAddress("http://myServer/myService/myService.Service1.svc"));

    ((BasicHttpBinding)client.Endpoint.Binding).MaxBufferSize = 200000000;
    ((BasicHttpBinding)client.Endpoint.Binding).SendTimeout = System.TimeSpan.FromMinutes(3);
    ((BasicHttpBinding)client.Endpoint.Binding).MaxReceivedMessageSize = 200000000;
#endif
}

MyServiceClient.cs (generated using Svcutil.exe from the command line)

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

#if !UNITY_EDITOR

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IService1")]
public interface IService1
{

    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService1/getFolderNames", ReplyAction = "http://tempuri.org/IService1/getFolderNamesResponse")]
    string[] getFolderNames();

    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService1/getFileNames", ReplyAction = "http://tempuri.org/IService1/getFileNamesResponse")]
    string[] getFileNames(string fldrPath);

    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService1/getFileData", ReplyAction = "http://tempuri.org/IService1/getFileDataResponse")]
    byte[] getFileData(string filePath);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IService1Channel : IService1, System.ServiceModel.IClientChannel
{
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class Service1Client : System.ServiceModel.ClientBase<IService1>, IService1
{

    public Service1Client()
    {
    }

    public Service1Client(string endpointConfigurationName) :
            base(endpointConfigurationName)
    {
    }

    public Service1Client(string endpointConfigurationName, string remoteAddress) :
            base(endpointConfigurationName, remoteAddress)
    {
    }

    public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
            base(endpointConfigurationName, remoteAddress)
    {
    }

    public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
            base(binding, remoteAddress)
    {
    }

    public string[] getFolderNames()
    {
        return base.Channel.getFolderNames();
    }

    public string[] getFileNames(string fldrPath)
    {
        return base.Channel.getFileNames(fldrPath);
    }

    public byte[] getFileData(string filePath)
    {
        return base.Channel.getFileData(filePath);
    }
}

#endif

The service is working fine as seen below

servicebrowserscreenshot

jtth
  • 876
  • 1
  • 12
  • 40
  • what version of System.ServiceModel.dll is in thee csproj file and what is the binary that get deployed – terrencep Nov 14 '19 at 21:25
  • @terrencep How do you mean? The version we added in Unity is Net framework 4.7 which says file version 4.7.2053.0. I can't seem to find it under references in the C++ project(s) generated from the UWP build. When browsing the "com.unity.multiplayer-hlapi.Runtime.Player" proj, or perhaps better put, one of the proj files shown when editing scripts from the Unity editor it reads runtime version v4.0.30319 and version 4.0.0.0. The path is the one we've included via Assets\Plugins\WSA\x86\System.ServiceModel.dll – jtth Nov 14 '19 at 21:37
  • The Basichttpbinding class should be available after referring to the ServiceModel library. Have you copied your Outconfig file to your Hololens app? The client proxy will use the configuration when instantiating. Besides, Does the Hololens app have the Adding service reference dialogHave you copied your Outconfig file in your Hololens app? which will automatically reference the ServiceMode library – Abraham Qian Nov 18 '19 at 07:41

0 Answers0