Reputation: 8172
I have some legacy code here, which has a WCF Service.
The service is called by a client through a generatedProxy.cs
I thought it should be simple and wanted to generate my own proxy by using svcutil.exe, but I get lots of different errors, depending on what I try (using running exe for download, using assembly, using webconfig). For example the svcutil tells me that the service may not publish metadata (seems to me that this is not true).
the webconfig has:
<serviceMetadata httpGetEnabled="true"/>
And it has a multisite binding
How can I generate such a proxy? Want to change some things in the contracts and then have a current version of the proxy generated.
At the moment I have no service reference, as it has the some errors when adding one as the svcutil does.
Any ideas?
-edit- The services are published through a selfhosted service, quite similar to the one in the WCF examples in the msdn. There are the endpoints for multiple services, which are implemented in dlls.
-edit 2- Here is the app.config of the self hosting service I have replaced some names, just to make it less special.
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="PersonDataModelContainer" connectionString="metadata=res://*/PersonDataModel.csdl|res://*/PersonDataModel.ssdl|res://*/PersonDataModel.msl;provider=System.Data.SqlServerCe.3.5;provider connection string="Data Source=|DataDirectory|\PersonDatabase.sdf"" providerName="System.Data.EntityClient"/>
</connectionStrings>
<system.serviceModel>
<bindings>
<netMsmqBinding>
<binding name="TransactionalNoSecurity" durable="true" exactlyOnce="true" maxReceivedMessageSize="2147483647" maxRetryCycles="1" receiveRetryCount="20" retryCycleDelay="00:05:00">
<security mode="None"></security>
</binding>
</netMsmqBinding>
<basicHttpBinding>
<binding name="TransportSecurity" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</basicHttpBinding>
<ws2007HttpBinding>
<binding name="NoSecurity" transactionFlow="true" maxReceivedMessageSize="200000" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<security mode="None"></security>
</binding>
<binding name="UNMessageSecurity" transactionFlow="true" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<security mode="Message">
<message clientCredentialType="UserName" establishSecurityContext="true"/>
</security>
</binding>
<binding name="CertMessageSecurity" transactionFlow="true" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<security mode="Message">
<message clientCredentialType="Certificate" establishSecurityContext="true"/>
</security>
</binding>
<binding name="DomainMessageSecurity" transactionFlow="true" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<security mode="Message">
<message clientCredentialType="Windows" establishSecurityContext="true"/>
</security>
</binding>
<binding name="RM_NoSecurity" transactionFlow="true" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<reliableSession enabled="true" ordered="false"/>
<security mode="None"></security>
</binding>
</ws2007HttpBinding>
<netTcpBinding>
<binding name="NoSecurity" transactionFlow="true">
<security mode="None"></security>
</binding>
<binding name="DomainMessageSecurity" transactionFlow="true" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<security mode="Message">
<message clientCredentialType="Windows"/>
</security>
</binding>
<binding name="CertMessageSecurity" transactionFlow="true" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<security mode="Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="SimpleServiceBehavior">
<serviceMetadata httpGetEnabled="True" policyVersion="Policy15"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MessagePlatform.LoggingService.GeneralLoggingService" behaviorConfiguration="SimpleServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
</baseAddresses>
</host>
<endpoint address="Logging" binding="basicHttpBinding" name="LoggingService" contract="MessagePlatform.LoggingService.Contracts.ILoggingService"/>
</service>
<service name="MessagePlatform.GatewayService.GeneralGatewayService" behaviorConfiguration="SimpleServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/"/>
</baseAddresses>
</host>
<endpoint address="gateway" binding="basicHttpBinding" name="GatewayService" contract="MessagePlatform.GatewayService.Contracts.IGatewayService"/>
<endpoint address="gateway" binding="basicHttpBinding" name="Db2GatewayService" contract="MessagePlatform.GatewayService.Contracts.IDb2GatewayService"/>
<endpoint address="gateway" binding="basicHttpBinding" name="Db1GatewayService" contract="MessagePlatform.GatewayService.Contracts.IDb1GatewayService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<client>
<endpoint name="LoggingServiceEP" address="http://localhost/Logging" binding="basicHttpBinding" contract="MessagePlatform.LoggingService.ILoggingService">
</endpoint>
<endpoint name="GatewayServiceEP" address="http://localhost/gateway" binding="basicHttpBinding" contract="MessagePlatform.GatewayService.IGatewayService">
</endpoint>
<endpoint name="GatewayServiceDb2" address="http://localhost/gateway" binding="basicHttpBinding" contract="MessagePlatform.GatewayService.IDb2GatewayService">
</endpoint>
<endpoint name="GatewayServiceDb1" address="http://localhost/gateway" binding="basicHttpBinding" contract="MessagePlatform.GatewayService.IDb1GatewayService">
</endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
Upvotes: 1
Views: 4568
Reputation: 1969
You also need to enable the Metadata Exchange Endpoint so you can create a new proxy:
<service name="MessagePlatform.GatewayService.GeneralGatewayService" behaviorConfiguration="SimpleServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/"/>
</baseAddresses>
</host>
<endpoint address="gateway" binding="basicHttpBinding" name="GatewayService" contract="MessagePlatform.GatewayService.Contracts.IGatewayService"/>
<endpoint address="gateway" binding="basicHttpBinding" name="Db2GatewayService" contract="MessagePlatform.GatewayService.Contracts.IDb2GatewayService"/>
<endpoint address="gateway" binding="basicHttpBinding" name="Db1GatewayService" contract="MessagePlatform.GatewayService.Contracts.IDb1GatewayService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
and run
svcutil http://localhost:8000/mex
Upvotes: 2