I'm using WindowsAuthentication in my silverlight application
Here is the setting that I have done in web.config
<authentication mode="Windows"/>
<basicHttpBinding>
<binding name="ServiceBinding" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
it's working fine ,but when ever i run fiddler, the application asks for the username and password! Does any one knows what is the reason behind that.
Thank you,
Naseem
In fiddler beta 2, there is a option "use proxy credentials".
Or you can customize the fiddler rule for your development server using:
if (oSession.HostnameIs("www.example.com")){
oSession.bypassGateway = true;
}
here is the link how to do it:
http://www.fiddler2.com/fiddler/dev/scriptsamples.asp
Related
I went through all the posts about this, nothing helped, so I posted this because I'm pulling my hair out.
I have a WCF web-service that has a method that receives a string, a long string. It works with a string of 2,390,158 characters (tried it) but won't work with a string of about 5,440,519 characters. (I'm using VS 2010)
I have this error:
System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response http:// localhost : 58014/ WSWebService.asmx. The reason may be that the connection endpoint service does not use the HTTP protocol. This may also be due to a HTTP request context has been ignored by the server (possibly due to the discontinuation of service).
I put all parameters I could at int.MaxValue (2,147,483,647) but it still won't work. Any help/suggestion is gladly appreciated.
I removed the "timeout" parts but it makes no difference :
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
Here's the binding in my app.config:
<bindings>
<basicHttpBinding>
<binding name="WSWebServiceSoap" maxReceivedMessageSize="20971520"
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>
My config server side is :
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="WSWebServiceSoap" maxReceivedMessageSize="20971520"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
maxBufferSize="20971520" maxBufferPoolSize="20971520"
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>
</system.serviceModel>
So yes, same configuration. Am I missing something?
Service was ASMX based, redone it pure WCF and now it works.
I am using one WCF service that deployed in server designed in .net 4.0v . But after processing all queues it is generating exception i.e. service sent back a fault indicating it is too busy to process the request. Please retry later. Please see the inner exception for fault details. I am using "wsHttpBinding"
<customBinding>
<binding name="CustomSecurity">
<security>
<localServiceSettings maxPendingSessions="1000" />
<secureConversationBootstrap />
</security>
</binding>
</customBinding>
<binding name="CustomSecurityxxx" closeTimeout="01:00:00"
openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="1000000" maxReceivedMessageSize="1000000"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="01:00:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
Thanks in advance. Can anyone help me to solve this problem.
Yes it is fixed.
I increased the serviceThrottling values
<serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000"/> from 200 and simply enclosed the service instances in using block so that the block will handle the scope of the object like initializing and disposing
Sample code syntax is as follows
xxxClient ServiceObject;
using (ServiceObject= new xxxClient())
{
try
{
your code goes here
}
catch (Exception ex)
{
ServiceObject.Abort();
}
}
Hope it will help to those facing the same problem.
I'm currently trying to use TransportWithMessageCredentials and https on my wcf project. I have set both the client and the server security mode="TransportWithMessageCredential" and the clientCredentialType="Windows".
When I go to get the credentials from CredentialCache.DefaultNetworkCredentials, the username, password and domain are all empty.
Any reason why these would be empty? If they will always be empty, where would I get the credentials to pass?
How would I pass the logged in user credentials to the service without prompting them for a login?
Client binding
<basicHttpBinding>
<binding name="ClientHttpEndpoint" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:02:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="4194304" maxBufferPoolSize="524288" maxReceivedMessageSize="4194304"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
Server binding
<basicHttpBinding>
<binding name="WindowsTransportCredentialBinding" maxBufferSize="524288"maxReceivedMessageSize="524288">
<readerQuotas maxDepth="128" maxStringContentLength="1048576" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
...
<service name="Test.DiagnosticService">
<endpoint binding="basicHttpBinding" bindingConfiguration="WindowsTransportCredentialBinding" name="ClientDiagnosticEndpoint" contract="Test.IDiagnostic" />
</service>
Code to set the username and password
ChannelFactory<IDiagnostic> test = new ChannelFactory<IDiagnostic>(DIAGNOSTIC_ENDPOINT_NAME);
test.Credentials.UserName.UserName = "TestUser";
test.Credentials.UserName.Password = "User";
return test.CreateChannel();
The ICredentials instance returned by DefaultCredentials cannot be used to view the user name, password, or domain of the current security context.
http://msdn.microsoft.com/en-us/library/system.net.credentialcache.defaultcredentials%28v=vs.90%29.aspx
I'm having problems setting up TransportWithMessageCredential on my wcf service.
Using the wcf Configuraton Editor, I set the Mode to TransportWithMessageCredential and the transportClientCredentialType to Windows in the web.config for the service and the app.config for my executable. I installed a self signed Cert on the erver and configured IIS to use it.
When I run my test app, I receive the following error:
System.InvalidOperationException: The username is not provided. Specify username in ClientCredentials.
It appears that the Windows credentials are not being passed to the wcf service and when i check the credentialCache.defaultCredentials, they are null. Any clues and/or tips on why this is and how to fix it? Thanks in advance
server 2003 / IIS 6.0 on an active directory domain.
web.config for service
<service name="Test.DiagnosticService">
<endpoint binding="basicHttpBinding" bindingConfiguration="WindowsTransportCredentialBinding" name="ClientDiagnosticEndpoint" contract="Test.IDiagnostic" />
</service>
<basicHttpBinding>
<binding name="WindowsTransportCredentialBinding" maxBufferSize="524288"
maxReceivedMessageSize="524288">
<readerQuotas maxDepth="128" maxStringContentLength="1048576" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
app.config for executable
<client>
<endpoint address="https://U-WM-3vIntegr8/test/Web/Services/Diagnostic.svc"
binding="basicHttpBinding" bindingConfiguration="ClientHttpEndpoint"
contract="Test.IDiagnostic" name="ClientDiagnosticEndpoint" />
</client>
<basicHttpBinding>
<binding name="ClientHttpEndpoint" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:02:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="4194304" maxBufferPoolSize="524288" maxReceivedMessageSize="4194304"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="1048576"
maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" proxyCredentialType="Windows"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
...Called from client
public static IDiagnostic GetDiagnosticService()
{
return new ChannelFactory<IDiagnostic>("ClientDiagnosticEndpoint").CreateChannel();
}
you need to manually fill in the credentials, they will not be automatically passed in this configuration. if that's what you look for you should set clientCredentialType to "Windows" on both client and server. Right now you need to set it manually:
proxy.ClientCredentials.Username.User = ""
proxy.ClientCredentials.Username.Password = ""
WCF Streaming transfer mode hosted on IIS and trying to send 2 MB file from a console application but it fails with this error. It works on 3 different servers and NOT one prod server where as all three share the same information.
Is it anything related to SSL on IIS ? what might be problem ?
how to set UploadReadAheadSize Metabase Property in IIS 7.0 ?
IIS 7
Windows Server 2008 64 bit
Client:
<basicHttpBinding>
<binding name="BasicHttpBinding_IFileStreamingService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Service:
<basicHttpBinding>
<binding name="HttpStreaming" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed" messageEncoding="Mtom">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<!--<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>-->
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>