问题描述:

We have been using a Windows 7 Enterprise machine for development and we have 7 wcf services.... All of them worked fine in the development machine... When we hosted the same services in Windows Server 2003 and IIS 6, we are facing a couple issues... One of the services is throwing a "An existing connection was forcibly closed by the remote host" error... the underlying connection gets closed right in the service call.... I have turned on logging with log4net and I have turned on tracing... In trace logs I found out that it completes almost all the steps and stops at the end of Execute step... So I put log4net debug statements in the code and it looks like the code is executing fine, retrieving the values from the database fine but it is shutting down the connection at the point when its returning the data. So right at the moment of returning the data some exception is closing down the connection... And I am not able to figure out why or whats causing the error... And the same code works fine in Windows 7 Enterprise machine... So I wasnt sure to look for code problems or is it some special setup that IIS 6.0 needs... Do you guys have any idea what might be wrong with the situation... thanks for any help.

And there is another service that shows an error "The requested service, 'XXXXXXXXXXXXXXXXX' could not be activated"... Frequent calls like immediate calls to same service seems to be causing this error.. Is there a way this can be avoided because some of the services seem to exhibit this behavior in Windows server 2003- IIS 6 and they all run just fine on the windows 7 machine?

网友答案:

Yes I enabled MessageLogging and found whats the first error.... It is failing to serialize the reason for that being - the response is assigned the objects from the request. So in Windows 7 it is allowing it and keeping the references alive but Windows Server 2003 discards all request objects so by the time response serializes some of the object references are no longer valid in windows 2003 and hence shuts down the connection. So that solves the first. So I just created a new object at the service and copied over the values and it started working.

相关阅读:
Top