Sorry for the repost but Im struggling to apply what I've read in the other posts to my problem.
I have a self hosted WCF service that runs fine when hosted on my machine and the client is on my machine.
I've tried to move the client to another machine and am now getting the "The caller was not authenticated by the service" error.
Please could someone advise on where the problem is occuring.
If you need anymore information please let me know.
Kind Regards
Ash
Here is the client config on my machine that works
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IDataCollector" 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">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.1.74:8080/" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="AshService.IDataCollector"
name="WSDualHttpBinding_IDataCollector">
<identity>
<userPrincipalName value="Ash-PC\Ash" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
Heres the server config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IDataCollector" 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">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="DataCollector">
<endpoint address="http://192.168.1.74:8080" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="IDataCollector" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
You are correct that your issues are due to Windows Authentication. As Rest Wing has described if you want to use AD credentials that the service has access to you will have to provide those credentials in order for the service to authenticate the client.
If you cannot use Windows authentication and you must authenticate the client you will need to look at other authentication techniques. One method is User Name/Password, but you will need to establish your own authentication algorithms. Another is certificates; the server and the client must have certificates installed (X509 certs work) to identify each other. There are other methods as well, but if I remember correctly only the above two will work with machines that are not in the same domain.
If you do not need to authenticate the client, set your security mode to "None". This would be a technique for publicly exposed services available over the internet.
You have differently configured bindings on client and service side.
Try using same binding configuration on both sides and see whether the exception is gone.
EDIT:
Credentials to be used for client authentication at service side must be provided as well.
// Provide client credentials
NetworkCredential credentials = new NetworkCredential( "UserName", "RealPasswordHere", "DomainOrMachineName" );
// Create factory that will be used to create proxy to the service
// Pass the client credentials into the factory
var factory = new ChannelFactory<AshService.IDataCollector>( "WSDualHttpBinding_IDataCollector" );
factory.Credentials.Windows.ClientCredential = credentials;
// Create and open proxy to the service
AshService.IDataCollector proxy = factory.CreateChannel();
( proxy as IChannel ).Open();
// Invoke an operation from the service
try this
svc.ClientCredentials.Windows.ClientCredential.UserName = "username";
svc.ClientCredentials.Windows.ClientCredential.Password = "password";
Related
I have a windows application that calls WCF service. I'm getting 400 Bad Request error in some clients.(Some clients I don't get error.) I increased maxReceivedMessageSize but it didn't work.
I increased maxReceivedMessageSize and other parameters.
Client Side app.config:
<bindings>
<wsHttpBinding>
<binding name="BasicHttpBinding_IAracRandevuWS"
closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2000000" maxReceivedMessageSize="2000000"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000"
maxBytesPerRead="2000000" maxNameTableCharCount="2000000" />
<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>
WCF Service app.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="BasicHttpBinding_IAracRandevuWS"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceSecurityAudit auditLogLocation="Application" serviceAuthorizationAuditLevel="Failure" messageAuthenticationAuditLevel="Failure" suppressAuditFailure="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="wsHttpBinding" scheme="http"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
How does the client generate the configuration file? Which way you use to call the service, adding service reference or ChannelFactory?
The wshttpbinding configuration does not well applied in the wshttpbinding, since we use the protocol mapping to host the service without using Bindingconfiguration property.
<protocolMapping>
<add binding="wsHttpBinding" scheme="http"/>
</protocolMapping>
Therefore, the default Clientcredentialtype is windows credential, and the security mode is message by default.
https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/security-of-wshttpbinding
We need to explicitly provide the windows credential on the client side.
ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
client.ClientCredentials.Windows.ClientCredential.UserName = "administrator";
client.ClientCredentials.Windows.ClientCredential.Password = "abcd1234!";
In order to test this, please do not use Fiddler, and call it from another computer in Console application by using add service reference.
Feel free to let me know if the problem still exists.
It was a network issue. After update switch, the problem has been solved.
I have the following Visual Studio Web application structure:
CustomerManagement\
- Services
- Customers.aspx
- Customers.aspx.cs
- CustomersWcfDS.svc
- Default.aspx
- web.config
The following code is inside the <configuration> in the web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICustomers" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1112/Services/Customers.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICustomers" contract="CustomersService.ICustomers" name="BasicHttpBinding_ICustomers" />
</client>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
I build the project and enter the following URL but there is no reactions.
http://localhost:1112/Services/Customers.svc
I also tried the following:
http://localhost:1112/Services/CustomersWcfDS.svc
and also
http://localhost:1110/Services/Customers.svc
and
http://localhost:1110/Services/CustomersWcfDS.svc
(The port 1110 was tested because of the Project Properties Port number was set to 1110.)
but it still fail to display something similar like the following illustration
So, is there any expert that can advise me where have my WCF service URL gone to?
Hi based on your image,
I think you have renamed the service name as Customers.svc . But still it refering to the previous one. What you can do is try to find the "SimpleService.svc" in your entire solution
and rename it as Customers.svc. If you have any problem put it as a comment.
I have an undocumented web service and I need to get the version of this web service by using client written in Visual C#. Problem is that I'm too much of a noob.
I have added the Service Reference in Visual Studio so I got a proxy file and the output.config file.
I get this row from VS to start a new instance of the class:
DentalScannerServiceClient client = new DentalScannerServiceClient();
So I put this in my console app:
DentalScannerServiceClient client = new DentalScannerServiceClient();
client.GetSoftwareVersion();
Get the error "No overload for method 'GetSoftwareVersion' takes 0 arguments".
Intelisens tells me this when i start typing client.GetSoftwareVersion:
Status DentalScannerServiceClient.GetSoftwareVersion(out string version)
So I try this code:
DentalScannerServiceClient client = new DentalScannerServiceClient();
string oo;
client.GetSoftwareVersion(out oo);
And then print the string but when I run the code I get this error:
"InvalidOperationException was unhandled"
"Could not find default endpoint element that references contract 'IDentalScannerService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."
Any ideas how to solve this or where to start looking? I am thankful for any help. Maybe it is something simple. I little experience with C# as well.
app.config:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ThisIsTest.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup><applicationSettings>
<ThisIsTest.Properties.Settings>
<setting name="ThisIsTest_localhost_DentalScannerService" serializeAs="String">
<value>http://localhost:8731/DentalServiceLib/DentalScannerService/</value>
</setting>
</ThisIsTest.Properties.Settings>
</applicationSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicEndPoint" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8731/DentalServiceLib/DentalScannerService/"
binding="basicHttpBinding" bindingConfiguration="BasicEndPoint"
contract="Scanner.IDentalScannerService" name="BasicEndPoint" />
</client>
</system.serviceModel>
</configuration>
output.config (got this from wsdl.exe, just did Project->Add Existing Item to add it:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicEndPoint" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8731/DentalServiceLib/DentalScannerService/"
binding="basicHttpBinding" bindingConfiguration="BasicEndPoint"
contract="IDentalScannerService" name="BasicEndPoint" />
</client>
</system.serviceModel>
</configuration>
This is most likely due to the endpoint showing up in your config file more than once. Find the section <system.serviceModel><client></client></system.serviceModel> and check for duplicates (based on the name)
if the client section is not present in your config file at all you will need to add it.
follow this template
<configuration>
<system.serviceModel>
<client>
<endpoint address="<address here>" binding="basicHttpBinding" contract="<full qualifeid class name to client interface>" name="<some name here>" />
</client>
</system.serviceModel>
</configuration>
Since I could not get this method to work I did it another way:
Use the .wsdl file generated by wsdl.exe in the SDK
Downloaded soapUI and started a new project with the wsdl file as initial file
soapUI created SOAP requests for all the objects in the web service
Tested the different calls in soapUI and got response live
Went into C# VS and made my console app first start the web service and then send simple SOAP requests using HttpWebRequest
Bingo
This method works surprisingly well!
I've looked at a number of similar topics on SO, but haven't found one that helps with this.
Have a WCF service that takes in XML to process. The XML file I'm reading from is ~600K.
The call works for small xml files (most of the time), but on the larger files I get the error:
System.ServiceModel.Security.MessageSecurityException:
An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
where the inner exception is:
System.ServiceModel.FaultException:
The message could not be processed. This is most likely because the action 'http://tempuri.org/ISapListener/ProcessSapRoles' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
Like I say... it works for small files, and my open, send, receive, close, and inactivity timeouts are all set to 10 minutes. It fails in about 20-30 seconds.
Also, the clock on the server and client are perfectly in sync (I've seen that posted as an answer).
My config files as they currently stand (I've played with a lot of settings):
Server:
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_Custom" closeTimeout="00:00:10"
openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" allowCookies="false"
maxReceivedMessageSize="1024768"
maxBufferPoolSize="1024768" >
<readerQuotas maxDepth="32" 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>
<services>
<service behaviorConfiguration="CSA.GS3.Services.SapListenerBehavior"
name="CSA.GS3.Services.SapListener">
<endpoint address="" binding="wsHttpBinding"
bindingConfiguration="wsHttpBinding_Custom"
contract="CSA.GS3.Services.ISapListener">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CSA.GS3.Services.SapListenerBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Client:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ISapListener1"
closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" allowCookies="false"
maxBufferPoolSize="1024768"
maxReceivedMessageSize="1024768">
<readerQuotas maxDepth="32" 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://gs3-test.us.tycoelectronics.com/SapListener/SapListener.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISapListener1"
contract="Gs3TestSapListener.ISapListener"
name="WSHttpBinding_ISapListener1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
I do have tracing enabled on the service, but I can't make sense out of the log files.
Other exceptions I've received while playing with the config settings:
System.ServiceModel.Security.SecurityNegotiationException
Secure channel cannot be opened because security negotiation with the remote endpoint has failed.
and
System.ServiceModel.ServiceActivationException
The requested service, 'http://../SapListener.svc' could not be activated.
If you think being able to make sense out of log files will help here, use svcTraceViewer. Just make sure you've actually set up tracing correctly. I have an article on my blog about this.
svcTraveViewer Debugging WCF Services
As regards large payloads, you may want to take a look at this MSDN article.
http://msdn.microsoft.com/en-us/library/ms733742.aspx
In particular Streaming Data.
System.ServiceModel.ServiceActivationException
The requested service, 'http://../SapListener.svc' could not be activated.
This could be a compilation error ou invalid configuration.
Is it WCF 4.0? Then you could remove your custom configuration and use automatic bindings. I also suggest you to try a binding other than wsHttpBinding, like basicHttpBinding.
I was able to get this to work with the following configuration:
Server:
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_Custom"
closeTimeout="00:10:00"
openTimeout="00:10:00"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
maxReceivedMessageSize="2097152"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2097152" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" 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:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ISapListener1" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2097152"
maxReceivedMessageSize="2097152"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" 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>
The only difference I can see is that I bumped up the maxReceivedMessageSize and maxBufferPoolSize... maybe I'm missing something else? If that was the issue, then the problem was that my overhead for the call was adding an additional 400+K to the 600K xml data I was sending
If possible and acceptable to client, you can break down the file into smaller chunks and send across, provided you don't have digital certificate etc and sorting options at client side.
I'm trying to consume a Service with an WCF Console Application. But the only thing I get as a Response is "The remote server returned an unexpected response: (400) Bad Request."
The Service is configured with the following options:
<services>
<service name="TryOut.BasicService" behaviorConfiguration="NicksBasicBehavior">
<host>
<baseAddresses>
<add baseAddress="http://192.168.10.67:8000/Service" />
</baseAddresses>
</host>
<endpoint address ="http://192.168.10.67:8000/Service"
name="NicksEndpoint"
binding="basicHttpBinding"
contract="TryOut.IBasicService"
bindingConfiguration="BasicBinding"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="NicksBasicBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<binding name="BasicBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
</security>
</binding>
The configuration file of my Client is the following:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NicksEndpoint" 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>
<client>
<endpoint address="http://192.168.10.67:8000/Service" binding="basicHttpBinding"
bindingConfiguration="NicksEndpoint" contract="ServiceReference1.IBasicService"
name="NicksEndpoint" />
</client>
Now everything works fine when I'm starting the client on the same PC as the service. But if I'm try to running the Client on a machine which is not in the domain of the server PC then I get an error, although I provide the Login information's in the client code:
c.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("Nick", "password", "mydomain");
Does anybody got an idea what I'm doing wrong and how can I fix it? Thanking you in anticipation!
According to this article on MSDN, it looks as if you need to specify your credentials differently:
WCFTestService.Service myService = new WCFTestService.Service();
myService.Credentials = System.Net.CredentialCache.DefaultCredentials;
MessageBox.Show(myService.GetData(123, true));
myService.Dispose();
Could you try to use this code and try to pass the Windows credentials into myService.Credentials ? Does that work?
Marc
have you tried specifing the userPrincipalName in the identity element on your clients endpoint?