如何调试:WCF服务调用在VS中工作,但不在IIS中 [英] How to debug: WCF service call works in VS, but not in IIS

查看:140
本文介绍了如何调试:WCF服务调用在VS中工作,但不在IIS中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ASP.Net AuthenticationService来验证我的Silverlight应用程序中的用户。我有一个Web应用程序,服务指向System.Web.ApplicationServices.AuthenticationService。我的web.config有定义的服务,端点,绑定,行为等。对于成员数据库,我使用的是具有MDF文件的SQL Express。

I am trying to use the ASP.Net AuthenticationService 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.

我相当肯定所有这些都是正确设置的,因为一切正常,如果我运行它在Visual Studio中。我的Silverlight应用程序调用AuthenticationService,传入一个用户名和密码,并返回一个响应。

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.

但是,当我部署到IIS时,调用AuthenticationService总是响应有一个例外:远程服务器返回错误:未找到

However, when I deploy to IIS, calling into the AuthenticationService always responds with an exception: "The remote server returned an error: Not Found"

我怀疑这与SQL Express有关,但还没有能够确定问题。我尝试在系统帐户下运行SQL Express。我尝试给网络服务帐户的完整权限给我的App_Data文件夹。我尝试了很多不同的连接字符串。

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.

无论如何,任何人都可以提供任何提示或参考,了解如何使用具有SQL Express和IIS的AuthenticationService部署Silverlight应用程序?

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?

更新:我安装了SQL Server 2008的试用版,并具有相同的结果。当使用Visual Studio运行但不能在IIS中运行时,我可以让所有的工作正常。如果有人有关于如何在IIS中使用Silverlight的AuthenticationService的参考资料或教程,我将不胜感激。

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.

更新2:问题出在我的身份验证设置SQL Server。我能够通过启用跟踪来跟踪这一点,如评论中所建议的。我已经更新了关于如何调试这样的问题的问题,其中您的服务调用在Visual Studio中工作,但不在IIS中。

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.

推荐答案

p>例如,我已将此代码添加到配置中:

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

* .svclog可以由Microsoft Service Trace Viewer打开。

现在更加明显的例外。

A file with the extension "*.svclog" can be opened by Microsoft Service Trace Viewer. And exceptions are more obvious now.

这篇关于如何调试:WCF服务调用在VS中工作,但不在IIS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆