I am trying to use the ASP.Net AuthenticationServ开发者_开发问答ice to authenticate users from my Silverlight application. I have a web application, with a service that points to "System.Web.ApplicationServices.AuthenticationService". My web.config has the service, endpoint, binding, behavior, etc defined. For the membership database, I am using SQL Express with an MDF file.
I'm fairly certain all of that is set up correctly because everything works fine if I run it in Visual Studio. My Silverlight app calls into the AuthenticationService, passes in a username and password, and gets back a response.
However, when I deploy to IIS, calling into the AuthenticationService always responds with an exception: "The remote server returned an error: Not Found"
I suspect this has something to do with SQL Express, but haven't been able to pinpoint the problem. I have tried running SQL Express under the System account. I tried giving the Network Services account full permissions to my App_Data folder. I have tried lots of different connection strings.
In any case, can anyone provide any tips or references for how to deploy a Silverlight application using the AuthenticationService with SQL Express and IIS?
Update: I installed the trial version of SQL Server 2008 and have the same results. I can get everything to work fine when running with Visual Studio, but not running in IIS. If anyone has a reference or a tutorial on how to use the AuthenticationService from Silverlight in IIS, I would appreciate it.
Update 2: The problem was with my authentication settings in SQL Server. I was able to track this down by enabling tracing, as suggested in the comments. I have updated the question to be about how to debug problems like this where your service calls work in Visual Studio but not in IIS.
For example, I've added this code to the config:
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Critical,Error" >
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Critical,Error">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="D:\WcfLog.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="xml" />
</sharedListeners>
<trace autoflush="true" />
A file with the extension "*.svclog" can be opened by Microsoft Service Trace Viewer.
And exceptions are more obvious now.
精彩评论