3D WCF Consumption

I have wcf web services that I host in IIS on localhost. I want to have access to them from Unity3d, but when playing a scene I get the following error:

InvalidOperationException: Client endpoint configuration 'BasicHTTPEndpoint' was not found in 0 endpoints. System.ServiceModel.ChannelFactory.ApplyConfiguration (System.String endpointConfig) System.ServiceModel.ChannelFactory.InitializeEndpoint (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) System.ServiceModel.ChannelFactory`1[IUnityStore]..ctor (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) System.ServiceModel.ClientBase`1[TChannel].Initialize (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) System.ServiceModel.ClientBase`1[TChannel]..ctor (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName) System.ServiceModel.ClientBase`1[TChannel]..ctor (System.String endpointConfigurationName) UnityStoreClient..ctor (System.String endpointConfigurationName) firstCall.Start () (at Assets/Scripts/firstCall.cs:8) 

Web service is created as:

 UnityStoreClient uc = new UnityStoreClient("BasicHTTPEndpoint"); uc.Open(); //i don't know if i need this ????? UnityStoreLibrary.User[] users = uc.GetAllUsers("1",null); for (int i=0;i<users.Length;i++) Debug.Log("username = " + users[i].username); 

I have a configuration file in the folder with my scripts, but I do not know if I should do anything with it. I created a unity class with svcutil from Visual Studio 2010.

+4
source share
2 answers

using System.ServiceModel;

this instruction was missing from my class implementation.

I called the web service as follows:

 UnityStoreClient client = new UnityStoreClient(new BasicHttpBinding(), new EndpointAddress(some_url)); 
+6
source

Actually the exception message gives you a hint about what is missing.

The ConfigurationManager cannot find any information related to your WCF service in the section of the web.config file.

The details of the WCF service you are calling should be stored in the web.config file. Your web.config file should have this endpoint definition:

 <system.serviceModel> <client> <endpoint name="BasicHTTPEndpoint" address="http://myUnits3DService.svc" binding="basicHttpBinding" contract="IService"/> ... 

You may also need to check information on using svcutil.exe here .

0
source

Source: https://habr.com/ru/post/1481835/


All Articles