I am writing a WCF service to upload files but it throws an exceptions when byte array has more than 16384 elements.
This is the exception detail:
The formatter threw an exception while
trying to deserialize the message:
Error in deserializing body of request
message for operation
'CreateDocument'. The maximum array
length quota (16384) has been exceeded
while reading XML data. This quota may
be increased by changing the
MaxArrayLength property on the
XmlDictionaryReaderQuotas object used
when creating the XML reader. Line 1,
position 22862.
The config for both client and server sets the maximum array length quota to 2147483647.
Client Config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IDocumentLibraryService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:50764/DocumentLibraryService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDocumentLibraryService"
contract="DocumentLibrary.IDocumentLibraryService" name="BasicHttpBinding_IDocumentLibraryService" />
</client>
Server Config:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IDocumentLibraryService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="BasicHttpBinding_IDocumentLibraryService">
<clear />
<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="Peninsula.DocumentLibrary.ServiceLayer.IDocumentLibraryService" />
<endpoint binding="basicHttpBinding" name="DocumentLibraryService" contract="Peninsula.DocumentLibrary.ServiceLayer.IDocumentLibraryService" address=""
bindingConfiguration="BasicHttpBinding_IDocumentLibraryService"/>
</service>
</services>
All I needed to do was to change Service name in web.config file to full service name with namespace:
<service name="SampleNameSpace.DocumentLibraryService">
<clear />
<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="Peninsula.DocumentLibrary.ServiceLayer.IDocumentLibraryService" />
<endpoint binding="basicHttpBinding" name="DocumentLibraryService" contract="Peninsula.DocumentLibrary.ServiceLayer.IDocumentLibraryService" address=""
bindingConfiguration="BasicHttpBinding_IDocumentLibraryService"/>
</service>
This is not really an answer since your configuration seems OK. I think you just need to check these values in the code (output to trace or debug) on the service host and the proxy to make sure the same values in config are loaded into your channels.
On possibility is that another threshold is reached and the error is misleading
Now I strongly advise against using byte array to upload files especially if you use XML. These will be represented as XML arrays and the structure will be hugely bloated XML which will take 10 times more than the original file.
I would use:
WCF Streaming which works with basic binding as well and is super fast
alternatively represent the byte array as base64 string. This will take 33% more space but not 1000%
UPDATE
You can trace the binding name that was used to configure the service (use it inside any of your WCF operations):
public int MyServiceOperation()
{
Trace.WriteLine(OperationContext.Current.EndpointDispatcher.ChannelDispatcher.BindingName)
....
Related
I have looked at most of the questions that relate to this issue and none of the solutions are working. The binds that I have are listed below...
Server
<basicHttpBinding>
<binding name="UploadSoap" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport"></security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="UploadSoapWeb" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</webHttpBinding>
<client>
<endpoint address="https:.../upload.asmx" binding="webHttpBinding" bindingConfiguration="UploadSoapWeb" contract="Upload.UploadSoap" name="UploadSoap" />
</client>
Client
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_service" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://.../service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_service"
contract="HH.service" name="BasicHttpBinding_service" />
</client>
I have tried both the basic binding and the web binding but I'm still receiving the error message.
Thanks
You haven't set an explicit binding for your service so it will default to basicHttpBinding with default configuration values. The default value for maxReceivedMessageSize will be 64KB.
Keep in mind that maxReceivedMessageSize is only applicable for the message receiver and not the message sender. The client does not need to set these values if it is sending a large message.
Update your server side binding to the following:
<basicHttpBinding>
<!-- Unnamed (default) binding-->
<binding maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text" /> <!-- Consider using Mtom if you're transfering binary data-->
<binding name="UploadSoap">
<security mode="Transport"></security>
</binding>
</basicHttpBinding>
<client>
<endpoint address="https:.../upload.asmx"
binding="basicHttpBinding"
bindingConfiguration="UploadSoap"
contract="Upload.UploadSoap" name="UploadSoap" />
</client>
The unnamed binding will provide the default values for any endpoint, server or client, using the basicHttpBinding without a bindingConfiguration.
I've assumed that your clients are not receiving a large message in response.
If you're receiving the 413 error from the service, then the problem appears to be that your service config does not have any explicitly defined service endpoints, so the binding configuration that you've created isn't being used.
You need to add a <services> section to your service config, like this:
<services>
<service name="YourServiceName">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="UploadSoap"
contract="YourContractName" />
</service>
</services>
As currently posted, there is nothing that tells WCF to use your defined binding configuration for the service, so by default out of the box WCF will use basicHttpBinding with the default (lower) values.
A second way to resolve this issue is to define a binding configuration and set it as the default for that type of binding by omitting the name attribute, like this:
<binding maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="Transport"></security>
</binding>
I generally prefer the first method (setting an explicit service endpoint), but either should work.
I wrote a self-hosted WCF service. When I run the server and the client, the client connects well. I rewrote the server as a Windows service. Now when I run the server and the client, the server is started, but the client fails upon request method with the error
The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was
Windows service is registered as LocalSystem. Server config:-
<system.serviceModel>
<services>
<service behaviorConfiguration="MyServiceTypeBehaviors" name="UCSService.UCSModule">
<endpoint address="" binding="basicHttpBinding" contract="UCSService.IUCSModule">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:9000/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
Client config:-
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding" closeTimeout="00:01:00"
openTimeout="00:00:30" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.101.123:9000/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpEndpointBinding" contract="UCSModuleClient.IUCSModule"
name="BasicHttpBinding_UCSModule" />
</client>
</system.serviceModel>
As I understand it, the main problem is that the server has become the service, but how to solve the problem I do not know. How can I resolve this problem?
Can you use google in the following fashion: https://www.google.com.bh/search?q=The+HTTP+request+is+unauthorized+with+client+authentication+scheme+%27Negotiate%27.&oq=The+HTTP+request+is+unauthorized+with+client+authentication+scheme+%27Negotiate%27.&aqs=chrome..69i57.384j0j7&sourceid=chrome&es_sm=93&ie=UTF-8
Possible solution: Try to run the service with the user Administrator
I have tried lot but no success,
I have changed readerQuotas maxStringContentLength to 2147483647 of both my WinForms as well as WCF config files but still maxStringContentLength is set to 8192.
Can any body tell me how to change it and where to change, on WinForms or WCF service.
Client side Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="ConnectWiseEntities" connectionString="data source=deepak;initial catalog=ConnectWise;persist security info=True;user id=sa;password=weexcel;" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:50841/SyncFile(WCF2)/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="SynWebService.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>
WCF Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 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>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Your client config seems ok, modifiy your service config and add the corresponding behavior to the service as below.
You need to correctly setup the binding and behavior.Right click your web config and select edit WCF configuration.
for example,
<bindings>
<basicHttpBinding>
<binding name="defaultBinding">
<readerQuotas maxStringContentLength="1048576" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Service1">
<endpoint address="http://localhost:56529/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="defaultBinding"
contract="IWebExtractServiceIWebExtractService">
</endpoint>
</service>
</services>
You have defined the binding configuration in your service's web config, but you never tell the service to use it, so the default values for basicHttpBinding are used.
In WCF 4.0+, you have two ways to do this (Sajeethran gave one).
You can define a configuration for a binding and set it as the default configuration for the service by omitting the name attribute on the binding configuration, like this:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Since the name attribute is ommitted, any services that are using this config will use the above binding configuration for the default for requests coming over the http protocol, unless overridden in a specific endpoint element's bindingCongifuration attribute.
The second way is to define an endpoint explicitly and assign the bindingCongifuration attribute the name of the binding configuration you've defined (again as shown in Sajeetharan's answer).
I've just increased the number of methods in my ServiceContract. when I update the Service Reference in Visual Studio I get the message:
Metadata contains a reference that cannot be resolved:
'net.tcp://xxxxx.com:8002/DataQueryService/mex'.
There is an error in the XML document.
The maximum nametable character
count quota (16384) has been exceeded while reading XML data. The
nametable is a data structure used to store strings encountered during
XML processing - long XML documents with non-repeating element names,
attribute names and attribute values may trigger this quota. This
quota may be increased by changing the MaxNameTableCharCount property
on the XmlDictionaryReaderQuotas object used when creating the XML
reader.
The original server side config was:
<services>
<service behaviorConfiguration="XXXXX.DataQueryService.ServiceBehavior" name="XXXXX.DataQueryService.QueryService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://xxxxx.com:8002/DataQueryService" />
</baseAddresses>
</host>
<endpoint name="MexEndpoint" address="mex" binding="customBinding" bindingConfiguration="unsecureTcpMex" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<customBinding>
<binding name="unsecureTcpMex">
<tcpTransport portSharingEnabled="True" />
</binding>
</customBinding>
</bindings>
which I modified to:
<bindings>
<customBinding>
<binding name="unsecureTcpMex">
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<tcpTransport portSharingEnabled="True" maxReceivedMessageSize="2147483647" />
</binding>
</customBinding>
</bindings>
What other changes do I need to make to my config to get this working?
Update
Following #Chris's advice I tried updating the config file for SVCUtil. I added a name to my endpoint so that it would match (updated above). The SvcUtil.config is now as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="unsecureTcpMex">
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint binding="customBinding" bindingConfiguration="unsecureTcpMex"
contract="IMetadataExchange"
name="MexEndpoint" />
</client>
</system.serviceModel>
</configuration>
<binding name="NameSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="1638400" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
Take a look to this line: maxNameTableCharCount="1638400"
I don't suppose its practical to split up the operations into multiple contracts? Mind if I ask how many service operations we're talking about?
Have you tried the solutions in this post?
http://social.msdn.microsoft.com/Forums/vstudio/en-US/17592561-c470-452a-a52c-2a5a2839582c/metadataexchangeclient-and-nametable-character-count-quota
Among other suggestions are using the Discovery protocol to read metadata, which does not have any reader quotas:
http://msdn2.microsoft.com/en-us/library/system.web.services.discovery.discoveryclientprotocol.aspx
The solution at the bottom suggests you change the default reader quotas in code before starting the service. I believe this would have to be done in a custom ServiceHost factory. Please let me know if you would assistance with that.
Hope this helps.
This should help:
http://geekswithblogs.net/claraoscura/archive/2007/08/20/114806.aspx
appears that the solution is to create a config file for svcutil and place it in the same folder as it.
Try setting the new value for the MaxNameTableCharCount property programmatically:
Binding binding = endpoint.Binding;
XmlDictionaryReaderQuotas myReaderQuotas = new XmlDictionaryReaderQuotas();
myReaderQuotas.MaxStringContentLength = something;
myReaderQuotas.MaxArrayLength = something;
myReaderQuotas.MaxBytesPerRead = something;
myReaderQuotas.MaxDepth = something;
myReaderQuotas.MaxNameTableCharCount = something;
binding.GetType().GetProperty("ReaderQuotas").SetValue(binding, myReaderQuotas, null);
Note: you have to set it BEFORE the client proxy and/or service host are created. Once created, they can't be changed.
i am trying to consuming wcf web service and got error
The identity check failed for the outgoing message. The expected identity is 'identity(http://schemas.xmlsoap.org/ws/2005/05/identity/right/possessproperty: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn)' for the 'http://localhost/SCVMMService/VirtualMachineManagementService.svc' target endpoint.
for consuming webservice i am using code :
Client.ClientCredentials.Windows.ClientCredential.Domain = "testlab.ourcp.com";
Client.ClientCredentials.Windows.ClientCredential.UserName = "administrator";
Client.ClientCredentials.Windows.ClientCredential.Password = "M!ndMasT23";
Client.ClientCredentials.UserName.UserName = "administrator";
Client.ClientCredentials.UserName.Password = "M!ndMasT23";
Client.Open();
WebConfig:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IVirtualMachineManagementService" 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"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/SCVMMService/VirtualMachineManagementService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IVirtualMachineManagementService" contract="ServiceReference1.IVirtualMachineManagementService" name="WSHttpBinding_IVirtualMachineManagementService">
<identity>
<servicePrincipalName value="DDC-SC-VMM02.testlab.ourcp.com\Administrator"/>
</identity>
</endpoint>
</client>
and in webService config file for identity use:
<dns value="localhost"/>
Is the WCF service you're trying to access configured to use Service Identity? If not, remove the entire identity element from the endpoint element because it's only used with the Service Indentity feature.