System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrect
I got this error message when deploy and use WCF with ASP.NET Membership over Internet. My WCF service use wsHttpBinding and Security mode = TransportWithMessageCredential. My machine for test are Windows 7, Visual Studio 2008 SP1, SQL Express 2005. I’ve spent more time to looking for solution. After that, It’s worked fine! Here are work around and solutions
Open Event Viewer
Following error was appeared:
Failed to generate a user instance of SQL Server due to failure in retrieving the user’s local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed. [CLIENT: <local machine>]
This is the root of problem.
Add following account to SQL Server
– IIS APPPOOL\DefaultAppPool
– Local System
– Local Services
2. Open the Application Pool of your website used.
You see: Identity: ApplicationPoolIdentity (Windows 7 IIS)
3. Change the Identity to one of other account then iisreset
Hope this help!