Authentication/Impersonation issue with ASP.NET call to WCF Service - asp.net

I have a web page that calls a WCF service that makes a sql database call using Integrated Security. I get an error saying, "Login failed for user 'CorpDomain\ServerName01$'". I want it so that it all layers will execute under the user's AD credetials (working in an intranet), ie: "CorpDomain\Albert".
On the server (Win 2008/IIS 7), I have Windows Authentication turned on and everything else off (including Anonymous) under Authentication for both the web client and the WCF service.
Here's my client web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Windows"/>
<identity impersonate="true"/>
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMyService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<!--<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>-->
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://myurladdress/MyServices/Service.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService"
contract="MySvc.IMyService" name="NetTcpBinding_IMyService" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="ClientUserNameBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
Here's my WCF service web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>
<connectionStrings>
<!--DB CONNECTION-->
<add name="myDB" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Carbon;Data Source=mydbname,10600" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.serviceModel>
<services>
<service name="WCFServices.MyService" behaviorConfiguration="MyServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8000/WCFServices/MyService"/>
</baseAddresses>
</host>
<endpoint address="" binding="netTcpBinding" contract="WCFServices.IMyService" bindingConfiguration="tcpWindowsSecurity" bindingNamespace="http://WCFServices.MySvc/"/>
<endpoint address="MEX" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="tcpWindowsSecurity" maxReceivedMessageSize="524288" maxBufferSize="524288">
<!--<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" protectionLevel="None" />
</security>-->
</binding>
</netTcpBinding>
</bindings>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true" >-->
<serviceHostingEnvironment >
<serviceActivations>
<add relativeAddress="~/MyService.svc" service="WCFServices.MyService"/>
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
on the client side:
Request.ServerVariables["AUTH_USER"].ToString() = "CorpDomain\Albert"
Page.User.Identity.Name = "CorpDomain\Albert"
System.Threading.Thread.CurrentPrincipal.Identity.Name = "CorpDomain\Albert"
System.Security.Principal.WindowsIdentity.GetCurrent().Name = "NT AUTHORITY\NETWORK SERVICE"
My client code is basically:
MySvc.MyServiceClient svc = new MySvc.MyServiceClient();
svc.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
Response.Write(svc.GetServiceHtml());
and on the WCF side:
ServiceSecurityContext.Current.WindowsIdentity.Name = "NT AUTHORITY\NETWORK SERVICE"
server side code is:
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public string GetServcieHtml()
{
string name, link;
StringBuilder html = new StringBuilder();
html.Append(ServiceSecurityContext.Current.WindowsIdentity.Name);
try
{
using (SqlConnection conn = GetDataConnection())
{
conn.Open();
SqlCommand sqlcom = new SqlCommand("dbo.runsomeproc", conn);
sqlcom.CommandType = CommandType.StoredProcedure;
SqlDataReader sqlDataReader = sqlcom.ExecuteReader();
while (sqlDataReader.Read())
{
// ** SOME CODE HERE **
}
conn.Close();
}
}
catch (Exception ex)
{
html.AppendLine("<br><br>ERROR:" + ex.Message + " " + ex.InnerException);
return html.ToString();
}
return html.ToString();
}
Note:
The error I get is: ERROR:Login failed for user 'CorpDomain\ServerName01$'.
Any idea what I'm doing wrong?

Also, correct me if I'm wrong, but in your client web.config, you have a behaviour that will set impersonation level to "Impersonation", but you do not reference that behaviour in your endpoint. Eg:
<client>
<endpoint address="net.tcp://myurladdress/MyServices/Service.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService"
contract="MySvc.IMyService" name="NetTcpBinding_IMyService" />
</client>
Should be:
<client>
<endpoint address="net.tcp://myurladdress/MyServices/Service.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService"
contract="MySvc.IMyService" name="NetTcpBinding_IMyService"
behaviorConfiguration="ClientUserNameBehavior" />
</client>

You also need to enable impersonation at the WCF service level as well.
This MSDN page contains all the details.

I don't know if this will help anyone, but I had this problem. The problem was due to the identity setting of the Application Pool that my service was using in IIS. If you set the appropriate identity there, you should be good. In my case, the default was set to NT Authority\Network Service.

Related

Reference to a web service in an .exe file

I have the next problem:
I have a reference to a web service, my app.config is alright and in my asp.net, visual basic code works perfect, but executing the .exe file I get the message "could not find default endpoint element that references contract in the servicemodel..."
this is and extract of my app.config:
<endpoint address="http://ADDRESS/AutenticaService.svc"
binding="basicHttpBinding" bindingConfiguration="AutenticaEndpoint"
contract="AutenticaService.AutenticaServiceContract" name="AutenticaEndpoint"/>
any clue?.. thanks in advance
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="SISEPrueba.My.MySettings.ChRiesgos_ProdConnectionString"
connectionString="Data Source=CBRTPWPAPL201;Initial Catalog=CHUBB_SEG_REPORTES;User ID=user_rpt;password=xxxx"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="myBehavior">
<callbackDebug includeExceptionDetailInFaults="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="AutenticaEndpoint" >
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://ADDRESS/ServicioSeguridad/AutenticaService.svc"
binding="basicHttpBinding" bindingConfiguration="AutenticaEndpoint"
contract="AutenticaService.AutenticaServiceContract" name="AutenticaEndpoint"/>
</client>
</system.serviceModel>
</configuration>

WCF REST/JSON Service UserNamePasswordValidator

I'm trying to use basic authentication with my WCF Rest/JSON service.
Therefore I've create a class which derives from "UserNamePasswordValidator" and added it to my web.config.
In IIS only Basic Authentication is enabled.
Unfortunately this class is never called. When I call a rest method in my browser the dialog for entering the username and password is shown but nothing happens after that.
Here my web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext"
value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<identity impersonate="true" />
</system.web>
<system.serviceModel>
<services>
<service name="myTimeMvc.Webservice.MyTimeRestService"
behaviorConfiguration="returnFaults">
<endpoint behaviorConfiguration="restfulBehavior"
binding="webHttpBinding"
bindingConfiguration="webBinding"
contract="myTimeMvc.Webservice.IMyTimeRestService" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="restfulBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceCredentials>
<!--<serviceCertificate findValue="MyWebSite"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectName" />-->
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="myTimeServiceDemoa.WcfExtension.CustomUserNameValidator,TestWcfServiceAuth" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
Here my CustomUserNameValidator.cs
namespace myTimeServiceDemoa.WcfExtension
{
public class CustomUserNameValidator : System.IdentityModel.Selectors.UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (null == userName || null == password)
{
throw new ArgumentNullException("You must provide both the username and password to access this service");
}
if (!(userName == "user1" && password == "test") && !(userName == "user2" && password == "test"))
{
throw new FaultException("Unknown Username or Incorrect Password");
}
}
}
}
UPDATE:
After two days of trying I give up now because I don't see what I may have done wrong. Seems this stuff is not working for me...
I investigated a lot and everything you need is to change Authentication of your WebApplication in IIS to "Basic" and add a custom "CustomUserNameValidator" in your web.config but this is not working!
Please correct me if I'm wrong.
My solution:
Use "Anonymous Authentication" in IIS
Use a "ServiceAuthorizationManager" and check HTTP-Headers in "CheckAccessCore"
Cheers,
Stefan

Receiving a WCF callback service from a ASP.NET web app hosted in IIS

I have been working on this issue for a couple of days now.
The problem has 3 working parts.
I have a ASP.NET site , WCF IIS hosted service and WPF xbap app.
What I'm trying to do is pass variables from the ASP.NET site to the WPF xbap app. So I have setup a WCF service with a wsDualHttpBinding and using callbacks to notify the ASP.NET and the xbap.
Now when I host the WCF service in IIS 6 on our server and run ASP.NET hosting in VS2012 iisexpress locally and xbap locally. It works fine.
But as soon as I publish the ASP.NET site to the IIS 6 on our server, callback are never received by the ASP.NET app. Both are in the application pool.
Is there a setting, or something I need to be looking for to have the ASP.NET to keep open the listening port for the callbacks? The XBAP is still receiving the callbacks, no problem.
The service config is as follows: (note I have maxed out the buffers because of simplicity for the moment to rule that out)
<configuration>
<system.diagnostics>
<sources>
<source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="web_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding receiveTimeout="00:01:00" sendTimeout="00:00:05" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="false" />
<protocolMapping>
<add scheme="http" binding="wsDualHttpBinding" />
</protocolMapping>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
The service has methods where clients will subscribe to callback lists. Then methods will increment through the list to send the invoke the callbacks.
[ServiceContract(CallbackContract = typeof(IClientCallback))]
public interface IVisualisationService
{
[OperationContract(IsOneWay = true)]
void SubscribeToRedenderHoles(string address);
[OperationContract(IsOneWay = true)]
void SubscribeToEditSelectedHoles(string address);
[OperationContract(IsOneWay = true)]
void SubscribeToShowHoles(string address);
[OperationContract(IsOneWay = true)]
void RedenderHoles(Hole3D[] holes, string address, int channelhashcode);
[OperationContract(IsOneWay = true)]
void EditSelectedHoles(Guid[] holesIds, string address);
[OperationContract(IsOneWay = true)]
void ShowHoles(string address);
}
public interface IClientCallback
{
[OperationContract(IsOneWay = true)]
void OnRenderHoles(Hole3D[] holes);
[OperationContract(IsOneWay = true)]
void OnEditSelectedHoles(Guid[] holesIds);
[OperationContract(IsOneWay = true)]
void OnShowHoles(int channelhashcode);
}
Below is the WCF Service header, Ive skipped putting in the methods.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class VisualisationService : IVisualisationService
{
Now for the ASP.NET Client web.config
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IVisualisationService" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://hims.mecha.com/VisualisationWcfService/VisualisationService.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IVisualisationService"
contract="VisualisationServiceReference.IVisualisationService"
name="WSDualHttpBinding_IVisualisationService" />
</client>
</system.serviceModel>
Then XBAP app client app.config
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IVisualisationService" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://hims.mecha.com/VisualisationWcfService/VisualisationService.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IVisualisationService"
contract="VisualisationService.IVisualisationService" name="WSDualHttpBinding_IVisualisationService" />
</client>
</system.serviceModel>
</configuration>
In both clients I have used the Add Service Reference method, to add the WCF to both the ASP.NET and XBAP projects.
I have setup both clients to have the code and of course handle the methods for each callback.
sealed class VisualisationManager : VisualisationService.IVisualisationServiceCallback
I know it looks a bit long winded, but I wanted to show as much about the problem as I could. I am completely lost, why it would work fine locally but not when hosted in IIS 6.
late answer but in case someone like me who get to this question through the Big G.
I had similar issue and the solution for me is to add a CallbackBehavior to the class which implement the callback interface (in your case; IClientCallback). like this:
[CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
public class ClientCallback : IClientCallback
...
Hope this help.

WF 4.0 adding WorkflowControlEndPoint to IIS hosted XAMLX service

I'm trying to add workflowControlEndpoint to my IIS hosted XAMLX service. I cannot reference the control endpoint from client, I keep getting the following error
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost/Test.xamlx/wce'.
Content Type application/soap+xml; charset=utf-8 was not supported by service 'http://mymachine/Test.xamlx/wce'. The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
I've the following web.config. Could someone point to me what I'm missing? Thanks and appreciate the help....
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" transferMode="StreamedResponse">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
<binding name="httpSecurityOff" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
transferMode="Streamed" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
<service name="Test">
<endpoint address="" binding="basicHttpBinding" contract="IService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="wce" binding="basicHttpBinding"
bindingConfiguration="httpSecurityOff"
contract="System.ServiceModel.Activities.IWorkflowInstanceMangement"
kind="workflowControlEndpoint" />
</service>
I was trying to get the IWorkflowInstanceManagement to work via the WCF Test Client, but I never could get it to find the metadata. So I just tried to communicate with it via code. It worked for me.
I created a new Workflow Service project, and my web.config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=localhost\SQLEXPRESS;Initial Catalog=WFS;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="workflowBehavior">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="true" />
<sqlWorkflowInstanceStore instanceCompletionAction="DeleteAll"
instanceEncodingOption="GZip"
instanceLockedExceptionAction="BasicRetry"
connectionStringName="ApplicationServices"
hostLockRenewalPeriod="00:00:20"
runnableInstancesDetectionPeriod="00:00:05" />
<workflowInstanceManagement authorizedWindowsGroup="AS_Administrators" />
<workflowUnhandledException action="Terminate" />
<workflowIdle timeToPersist="00:01:00" timeToUnload="00:01:00" />
</behavior>
<behavior name="wceBehavior">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="Service1" behaviorConfiguration="workflowBehavior">
<endpoint binding="basicHttpBinding" address="" contract="IService" />
<endpoint binding="basicHttpBinding" address="wce" kind="workflowControlEndpoint" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Then I created a console app with the following code (I know this is not the best way to use ChannelFactory):
var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
var channelFactory = new ChannelFactory<IWorkflowInstanceManagement>(binding);
var channel = channelFactory.CreateChannel(new EndpointAddress("http://localhost/WorkflowControlTest/Service1.xamlx/wce"));
channel.Cancel(new Guid("DE212DE0-6BFF-4096-BF30-F6ACB2923B50"));
My workflow just runs in a loop running a delay for a few minutes. I was able to start a workflow instance via the WCF Test Client, then grab the Workflow Instance ID from the persistence database, and then run the console app to cancel the workflow.
Go to "Control Panel > Programs and Features > Turn Windows Features on or off" and check if following features are checked:
.NET Framework 3.5
.NET Framework 4.5 Advanced Services > WCF Services

How to host workflow service (.xamlx) with net.tcp binding on IIS 7.0?

I am hosting Workflow service on iis 7.0 with net.tcp binding. My config file like as
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<appSettings>
<add key="SMTPAddress" value="000.00.0.00"/>
<add key="ToAddress" value="abc#abc.com"/>
<add key="FromAddress" value="abc#abc.com"/>
<add key="SMTPUserName" value="abc#abc.com"/>
<add key="SMTPPassword" value ="abc#abc.com"/>
</appSettings>
<connectionStrings>
<add name="RewindConnectionString" connectionString="Data Source=xxx;User Id=xxx;Password=xxx;Connection Timeout=5" providerName="Oracle.DataAccess.Client" />
</connectionStrings>
<system.serviceModel>
<tracking>
<profiles>
<trackingProfile name="Sample Tracking Profile">
<workflow activityDefinitionId="*">
<workflowInstanceQueries>
<workflowInstanceQuery>
<states>
<state name="*"/>
</states>
</workflowInstanceQuery>
</workflowInstanceQueries>
<activityStateQueries>
<activityStateQuery activityName="*">
<states>
<state name="*"/>
</states>
<variables>
<variable name="*"/>
</variables>
</activityStateQuery>
</activityStateQueries>
<activityScheduledQueries>
<activityScheduledQuery activityName="*" childActivityName="*"/>
</activityScheduledQueries>
<faultPropagationQueries>
<faultPropagationQuery faultSourceActivityName="*" faultHandlerActivityName="*"/>
</faultPropagationQueries>
<customTrackingQueries>
<customTrackingQuery name="*" activityName="*"/>
</customTrackingQueries>
</workflow>
</trackingProfile>
</profiles>
</tracking>
<services>
<service name="RewindTest" behaviorConfiguration="RewindTest_Behavior">
<endpoint address="RewindTest"
binding="netTcpBinding" contract="IRewindTestService" name="RewindTestNetTcpEndPoint" bindingConfiguration="RewindTestBinding" />
<endpoint address="wce"
binding="netTcpBinding" kind="workflowControlEndpoint" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9095/Service.Workflow.RewindTest/RewindTest" />
</baseAddresses>
</host>
<endpoint address="mex"
binding="mexTcpBinding"
name="MEX"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding portSharingEnabled="true" name="RewindTestBinding" closeTimeout="00:10:00" openTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<standardEndpoints>
<workflowControlEndpoint>
<standardEndpoint/>
</workflowControlEndpoint>
</standardEndpoints>
<extensions>
<behaviorExtensions>
<add name="oracleInstanceStore" type="Devart.Data.Oracle.Activities.Configuration.OracleInstanceStoreElement, Devart.Data.Oracle.WorkflowFoundation" />
<add name="oracleTracking" type="Devart.Data.Oracle.Activities.Configuration.OracleTrackingElement, Devart.Data.Oracle.WorkflowFoundation" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="RewindTest_Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="false"/>
<!-- 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"/>
<oracleTracking
connectionString="User Id=xxx;Password=xxx;Server=xxx;"
profileName="Sample Tracking Profile" />
<oracleInstanceStore
connectionString="User Id=xxx;Password=xxx;Server=xxx;"
instanceEncodingOption="None"
instanceCompletionAction="DeleteNothing"
instanceLockedExceptionAction="NoRetry"
hostLockRenewalPeriod="00:00:30"
runnableInstancesDetectionPeriod="00:00:05" />
<workflowIdle timeToUnload="0"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Now my issue is i am unable to generate proxy through net.tcp binding but i can generate it through http. http://testsrv.com/RewindService/RewindTest.xamlx?wsdl. then i am unable to call receive operation method. Although it is workking fine with local console Host.
As we know that workflow service is similar to wcf service. So I decided to reconsider my deployment steps. I found a very good link about it and follow and check each and every step carefully and able to resolved my problem.
http://galratner.com/blogs/net/archive/2010/10/08/setting-up-a-nettcpbinding-enabled-wcf-service-in-iis-7.aspx
My configuration is ok and updated the tcp port no. it works like a charm.

Resources