Error consuming WCF service in Windows Service

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi,

I have a windows service that consumes a WCF service. It works well when I
run this service under my AD account, which is in the admin group of the os.
But if I run it under the defaul Local System account, it reports error like
the following:
---The socket connection was aborted. This could be caused by an error
processing your message or a receive timeout being exceeded by the remote
host, or an underlying network resource issue. Local socket timeout was
'00:10:00'.

Server stack trace:
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset,
Int32 count)
at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection
connection, TimeoutHelper& timeoutHelper)
at
System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan
timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan
timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
--
I can't figure why it doesn't work in the defaul account, is there any
security issue?

Thanks.

Daniel
 
Hi Daniel,

From your description, you're encountering some problem when try consuming
a WCF service in a windows service application. Also, the problem occurs
when you use LOCAL SYSTEM to run the windows service(work well if use a
domain account), correct?

From a general view, the problem does be likely due to
security/authentication related issue. Would you provide some further
information about your WCF service such as whether it has used transport
security or message layer security and whether it use windows
authentication and require a client identity when accessing it? Since
LOCAL SYSTEM is a local account, when you accessing the remote service and
the service require a valid windows identity, it may not recognize the
LOCAL SYSTEM identity of your client machine(where the windows service
runs).

Also, for test, you can try a simple WCF service without
authentication/security to see whether it can be called correctly.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: =?Utf-8?B?RGFuaWVs?= <[email protected]>
Subject: Error consuming WCF service in Windows Service
Date: Thu, 21 Feb 2008 17:18:01 -0800
Hi,

I have a windows service that consumes a WCF service. It works well when I
run this service under my AD account, which is in the admin group of the os.
But if I run it under the defaul Local System account, it reports error like
the following:
---The socket connection was aborted. This could be caused by an error
processing your message or a receive timeout being exceeded by the remote
host, or an underlying network resource issue. Local socket timeout was
'00:10:00'.

Server stack trace:
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset,
Int32 count)
at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble
(IConnection connection, ArraySegment`1 preamble, TimeoutHelper&
timeoutHelper)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnec tionPoolHelper.AcceptPooledConnection(IConnection
connection, TimeoutHelper& timeoutHelper)
at
System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeS pan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeS pan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSp
an
timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan
timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallM
essage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
--
I can't figure why it doesn't work in the defaul account, is there any
security issue?

Thanks.

Daniel
 
Thanks, Steven. This is the security setting in the service:
<netTcpBinding>
<binding name="NewBinding0" closeTimeout="00:02:00"
openTimeout="00:02:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
maxConnections="100" maxReceivedMessageSize="655360000">
<security>
<transport protectionLevel="None" />
</security>
</binding>
</netTcpBinding>
I don't really need the message be protected, security isn't an issue yet,
so if there is anyway to get the Local System calling the service, security
could be sacrificed.

Daniel


"Steven Cheng" said:
Hi Daniel,

From your description, you're encountering some problem when try consuming
a WCF service in a windows service application. Also, the problem occurs
when you use LOCAL SYSTEM to run the windows service(work well if use a
domain account), correct?

From a general view, the problem does be likely due to
security/authentication related issue. Would you provide some further
information about your WCF service such as whether it has used transport
security or message layer security and whether it use windows
authentication and require a client identity when accessing it? Since
LOCAL SYSTEM is a local account, when you accessing the remote service and
the service require a valid windows identity, it may not recognize the
LOCAL SYSTEM identity of your client machine(where the windows service
runs).

Also, for test, you can try a simple WCF service without
authentication/security to see whether it can be called correctly.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: =?Utf-8?B?RGFuaWVs?= <[email protected]>
Subject: Error consuming WCF service in Windows Service
Date: Thu, 21 Feb 2008 17:18:01 -0800
Hi,

I have a windows service that consumes a WCF service. It works well when I
run this service under my AD account, which is in the admin group of the os.
But if I run it under the defaul Local System account, it reports error like
the following:
---The socket connection was aborted. This could be caused by an error
processing your message or a receive timeout being exceeded by the remote
host, or an underlying network resource issue. Local socket timeout was
'00:10:00'.

Server stack trace:
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset,
Int32 count)
at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble
(IConnection connection, ArraySegment`1 preamble, TimeoutHelper&
timeoutHelper)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnec tionPoolHelper.AcceptPooledConnection(IConnection
connection, TimeoutHelper& timeoutHelper)
at
System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeS pan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeS pan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSp
an
timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan
timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallM
essage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
--
I can't figure why it doesn't work in the defaul account, is there any
security issue?

Thanks.

Daniel
 
Hi Daniel,

Thanks for your reply.

Yes, the security related setting of WCF service endpoing is in the binding
configuration area. However, I noticed that you only set the
"protectionLevel" of the netTcpBinding to "none", this means that there is
no encryption and integrity protect for the transferred messages and
authentication will still exists. I think you can try the following
setting to completely turn off the security(for test purpose):

#set the mode to "None"
=======================
<bindings>
<netTcpBinding>
<binding name="netTcpBindingConfig" >
<security mode="None" >
<transport protectionLevel="None"/>
</security>

</binding>
</netTcpBinding>

</bindings>
========================

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?RGFuaWVs?= <[email protected]>
References: <[email protected]>
Subject: RE: Error consuming WCF service in Windows Service
Date: Fri, 22 Feb 2008 01:09:00 -0800
Thanks, Steven. This is the security setting in the service:
<netTcpBinding>
<binding name="NewBinding0" closeTimeout="00:02:00"
openTimeout="00:02:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
maxConnections="100" maxReceivedMessageSize="655360000">
<security>
<transport protectionLevel="None" />
</security>
</binding>
</netTcpBinding>
I don't really need the message be protected, security isn't an issue yet,
so if there is anyway to get the Local System calling the service, security
could be sacrificed.

Daniel


"Steven Cheng" said:
Hi Daniel,

From your description, you're encountering some problem when try consuming
a WCF service in a windows service application. Also, the problem occurs
when you use LOCAL SYSTEM to run the windows service(work well if use a
domain account), correct?

From a general view, the problem does be likely due to
security/authentication related issue. Would you provide some further
information about your WCF service such as whether it has used transport
security or message layer security and whether it use windows
authentication and require a client identity when accessing it? Since
LOCAL SYSTEM is a local account, when you accessing the remote service and
the service require a valid windows identity, it may not recognize the
LOCAL SYSTEM identity of your client machine(where the windows service
runs).

Also, for test, you can try a simple WCF service without
authentication/security to see whether it can be called correctly.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: =?Utf-8?B?RGFuaWVs?= <[email protected]>
Subject: Error consuming WCF service in Windows Service
Date: Thu, 21 Feb 2008 17:18:01 -0800
Hi,

I have a windows service that consumes a WCF service. It works well when I
run this service under my AD account, which is in the admin group of
the
os.
But if I run it under the defaul Local System account, it reports error like
the following:
---The socket connection was aborted. This could be caused by an error
processing your message or a receive timeout being exceeded by the remote
host, or an underlying network resource issue. Local socket timeout was
'00:10:00'.

Server stack trace:
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset,
Int32 count)
at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble
(IConnection connection, ArraySegment`1 preamble, TimeoutHelper&
timeoutHelper)
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnec
tionPoolHelper.AcceptPooledConnection(IConnection
connection, TimeoutHelper& timeoutHelper)
at
System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeS
pan timeout)
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeS
pan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSp
an
timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan
timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallM
essage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
--
I can't figure why it doesn't work in the defaul account, is there any
security issue?

Thanks.

Daniel
 
Thanks for your quick reply Daniel,

Well, that tells us the problem does be the security context(and the WCF
authentication). Though you may work with security turned off, I still
suggest you have a look at the WCF stuffs and apply some basic security
features so as to make your service secured(also useful for future
cases...):

#Security Overview
http://msdn2.microsoft.com/en-us/library/ms735093.aspx

#Programming WCF Security
http://msdn2.microsoft.com/en-us/library/ms731925.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: =?Utf-8?B?RGFuaWVs?= <[email protected]>
References: <[email protected]>
<sAcF#[email protected]>
 
The settings you suggested did not display properly on the post - can you resubmit it.

Best Regards,

Walt
Hi,

I have a windows service that consumes a WCF service. It works well when I
run this service under my AD account, which is in the admin group of the os.
But if I run it under the defaul Local System account, it reports error like
the following:
---The socket connection was aborted. This could be caused by an error
processing your message or a receive timeout being exceeded by the remote
host, or an underlying network resource issue. Local socket timeout was
'00:10:00'.

Server stack trace:
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer,
Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset,
Int32 count)
at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer,
Int32 offset, Int32 size, TimeSpan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection
connection, TimeoutHelper& timeoutHelper)
at
System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan
timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan
timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
--
I can't figure why it doesn't work in the defaul account, is there any
security issue?

Thanks.

Daniel
On Friday, February 22, 2008 3:45 AM stchen wrote:
Hi Daniel,

From your description, you're encountering some problem when try consuming
a WCF service in a windows service application. Also, the problem occurs
when you use LOCAL SYSTEM to run the windows service(work well if use a
domain account), correct?

From a general view, the problem does be likely due to
security/authentication related issue. Would you provide some further
information about your WCF service such as whether it has used transport
security or message layer security and whether it use windows
authentication and require a client identity when accessing it? Since
LOCAL SYSTEM is a local account, when you accessing the remote service and
the service require a valid windows identity, it may not recognize the
LOCAL SYSTEM identity of your client machine(where the windows service
runs).

Also, for test, you can try a simple WCF service without
authentication/security to see whether it can be called correctly.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------

os.
like
buffer,
buffer,
offset,
(IConnection connection, ArraySegment`1 preamble, TimeoutHelper&
timeoutHelper)
tionPoolHelper.AcceptPooledConnection(IConnection
pan timeout)
pan timeout)
timeout)
timeout)
an
outs,
essage methodCall, ProxyOperationRuntime operation)
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
On Thursday, April 29, 2010 2:29 PM Thien Tran wrote:
I have a solution.



in HTS.Server.Data



DBConntion.cs



public class DBConnection

{

public static SqlConnection Conn;

public DBConnection()

{

try

{

string strSQL = "server=localhost\\SQLEXPRESS; Initial Catalog=QLNS;Integrated security = True";

Conn = new SqlConnection(strSQL);

Conn.Open();

}

catch (System.Exception ex)

{

throw ex;

}

}

}



AccountDAL.cs I coded :



public DataTable GetAllAccount()

{

DataTable dtAccount = new DataTable();

string strsql = "select * from tblTaiKhoan";

SqlDataAdapter daAccount = new SqlDataAdapter(strsql,DBConnection.Conn);

daAccount.Fill(dtAccount);

return dtAccount;



}





in HTS.Server.DBService

NhanVienService.cs I coded :



public System.Data.DataTable GetAllAccount()

{

System.Data.DataTable dtAccount = new System.Data.DataTable();

dtAccount = accountdal.GetAllAccount();

return dtAccount;

}

INhanvienService.cs I coded :



[OperationContract]

System.Data.DataTable GetAllAccount();



HTS.Server

App.config :

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

</configSections>





<connectionStrings>

<add name="HTS.Server.Data.Properties.Settings.QLNhanSuConnectionString"

connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=QLNhanSu;Integrated Security=True"

providerName="System.Data.SqlClient" />

<add name ="QLNhanSuConnectionString"

connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=QLNhanSu;Integrated Security=True"

providerName="System.Data.SqlClient" />

</connectionStrings>



<system.serviceModel>

<services>

<!-- List of services -->

<!-- TienCocService -->

<service name="HTS.Server.DBService.NhanVienService"

behaviorConfiguration="SimpleServiceBehavior">

<host>

<baseAddresses>

<add baseAddress="net.tcp://localhost:8686/DBService/"/>

</baseAddresses>

</host>

<endpoint name="NetTcpBinding_IDBService"

contract="HTS.Server.DBService.INhanVienService"

binding="netTcpBinding"

address="NhanVien"/>

<endpoint address="NhanVien/mex"

binding="mexTcpBinding"

contract="IMetadataExchange" />

</service>



</services>

<bindings>

<netTcpBinding>

<binding name="NetTcpBinding_IDBService">

<readerQuotas maxStringContentLength="2147483647"/>

</binding>

</netTcpBinding>

</bindings>

<behaviors>

<serviceBehaviors>

<behavior name="SimpleServiceBehavior">

<serviceMetadata httpGetEnabled="False" policyVersion="Policy15" />

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>

</configuration>



In HTS.Client



Form1.cs I coded :



DataTable dtAccount = new DataTable();

dtAccount = _clientNhanvien.GetAllAccount();

this.dataGridView2.DataSource = dtAccount;

app.config :

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<system.serviceModel>

<bindings>

<netTcpBinding>

<binding name="NetTcpBinding_IDBService" closeTimeout="00:01:00"

openTimeout="00:20:00" receiveTimeout="00:30:00" sendTimeout="00:03:00"

transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"

hostNameComparisonMode="StrongWildcard" listenBacklog="10"

maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="100"

maxReceivedMessageSize="2147483647">

<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">

<extendedProtectionPolicy policyEnforcement="Never" />

</transport>

<message clientCredentialType="Windows" />

</security>

</binding>

</netTcpBinding>

</bindings>

<client>

<endpoint address="net.tcp://localhost:8686/DBService/NhanVien"

binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IDBService"

contract="NhanVienService.INhanVienService" name="NetTcpBinding_IDBService">

<identity>

<userPrincipalName value="TranNgocHau-PC\TranNgocHau" />

</identity>

</endpoint>

</client>

</system.serviceModel>

</configuration>





Error : The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:04:59.7830000'.



I take much time for this exercise.I try to config file app.config closeTimeout="00:01:00"

openTimeout="00:20:00" receiveTimeout="00:30:00" sendTimeout="00:03:00" but It does not work, please help me...
On Thursday, April 29, 2010 2:30 PM Thien Tran wrote:
I have a solution.



in HTS.Server.Data



DBConntion.cs



public class DBConnection

{

public static SqlConnection Conn;

public DBConnection()

{

try

{

string strSQL = "server=localhost\\SQLEXPRESS; Initial Catalog=QLNS;Integrated security = True";

Conn = new SqlConnection(strSQL);

Conn.Open();

}

catch (System.Exception ex)

{

throw ex;

}

}

}



AccountDAL.cs I coded :



public DataTable GetAllAccount()

{

DataTable dtAccount = new DataTable();

string strsql = "select * from tblTaiKhoan";

SqlDataAdapter daAccount = new SqlDataAdapter(strsql,DBConnection.Conn);

daAccount.Fill(dtAccount);

return dtAccount;



}





in HTS.Server.DBService

NhanVienService.cs I coded :



public System.Data.DataTable GetAllAccount()

{

System.Data.DataTable dtAccount = new System.Data.DataTable();

dtAccount = accountdal.GetAllAccount();

return dtAccount;

}

INhanvienService.cs I coded :



[OperationContract]

System.Data.DataTable GetAllAccount();



HTS.Server

App.config :

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

</configSections>





<connectionStrings>

<add name="HTS.Server.Data.Properties.Settings.QLNhanSuConnectionString"

connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=QLNhanSu;Integrated Security=True"

providerName="System.Data.SqlClient" />

<add name ="QLNhanSuConnectionString"

connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=QLNhanSu;Integrated Security=True"

providerName="System.Data.SqlClient" />

</connectionStrings>



<system.serviceModel>

<services>

<!-- List of services -->

<!-- TienCocService -->

<service name="HTS.Server.DBService.NhanVienService"

behaviorConfiguration="SimpleServiceBehavior">

<host>

<baseAddresses>

<add baseAddress="net.tcp://localhost:8686/DBService/"/>

</baseAddresses>

</host>

<endpoint name="NetTcpBinding_IDBService"

contract="HTS.Server.DBService.INhanVienService"

binding="netTcpBinding"

address="NhanVien"/>

<endpoint address="NhanVien/mex"

binding="mexTcpBinding"

contract="IMetadataExchange" />

</service>



</services>

<bindings>

<netTcpBinding>

<binding name="NetTcpBinding_IDBService">

<readerQuotas maxStringContentLength="2147483647"/>

</binding>

</netTcpBinding>

</bindings>

<behaviors>

<serviceBehaviors>

<behavior name="SimpleServiceBehavior">

<serviceMetadata httpGetEnabled="False" policyVersion="Policy15" />

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>

</configuration>



In HTS.Client



Form1.cs I coded :



DataTable dtAccount = new DataTable();

dtAccount = _clientNhanvien.GetAllAccount();

this.dataGridView2.DataSource = dtAccount;

app.config :

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<system.serviceModel>

<bindings>

<netTcpBinding>

<binding name="NetTcpBinding_IDBService" closeTimeout="00:01:00"

openTimeout="00:20:00" receiveTimeout="00:30:00" sendTimeout="00:03:00"

transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"

hostNameComparisonMode="StrongWildcard" listenBacklog="10"

maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="100"

maxReceivedMessageSize="2147483647">

<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">

<extendedProtectionPolicy policyEnforcement="Never" />

</transport>

<message clientCredentialType="Windows" />

</security>

</binding>

</netTcpBinding>

</bindings>

<client>

<endpoint address="net.tcp://localhost:8686/DBService/NhanVien"

binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IDBService"

contract="NhanVienService.INhanVienService" name="NetTcpBinding_IDBService">

<identity>

<userPrincipalName value="TranNgocHau-PC\TranNgocHau" />

</identity>

</endpoint>

</client>

</system.serviceModel>

</configuration>





Error : The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:04:59.7830000'.



I take much time for this exercise.I try to config file app.config closeTimeout="00:01:00"

openTimeout="00:20:00" receiveTimeout="00:30:00" sendTimeout="00:03:00" but It does not work, please help me...
 
Back
Top