WCF Service reference with different binding than App.config in service library
I am working on an application, that when it's rolled out will have a
SQL server thats accessed by a WCF Service library running as a Windows
Service. The application will be accessed via intranet or through VPN
(Cisco). However during development I have the test database and
Windows Service WCF library running on our own development server. The
customer want's to be able to try the different builds from their own
computers (inside their Domain) and access the database on our
development server. To do this I have disabled the security functions
in the App.config file of the WCF library as follows:
?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="service.Lib.MyService" behaviorConfiguration="Service.Lib.ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://MyServer.com:8080/Service.Lib/MyService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address ="" binding="basicHttpBinding"
contract="Service.Lib.MyIService" bindingConfiguration="Binding1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<!--<dns value="localhost"/>-->
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service.Lib.ServiceBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="Binding1">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
My
problem is, that when I create the service reference in the
Businesslogic library I get this config info from the WFC library:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_MyIService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://Myserver.com:8080/Service.Lib/MyService/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_MyIService"
contract="ServiceRef.SuperfosIService" name="WSHttpBinding_MyIService">
<identity>
<servicePrincipalName value="host/dellserver" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
can anyone explain me the reason for this, and even better come up with a solution?
Thank you very much.