简体   繁体   English

将ADO.Net数据服务应用程序推广到IIS的问题

[英]Problem rolling out ADO.Net Data Service application to IIS

I am adding a ADO.Net Data Service lookup feature to an existing web page. 我正在向现有网页添加ADO.Net数据服务查找功能。 Everything works great when running from visual studio, but when I roll it out to IIS, I get the following error: 从visual studio运行时,一切都很好,但当我将它推出到IIS时,我收到以下错误:

Request Error 请求错误
The server encountered an error processing the request. 服务器遇到处理请求的错误。 See server logs for more details. 请参阅服务器日志以获取更多详

I get this even when trying to display the default page, ie: 即使在尝试显示默认页面时,我也会得到这个,即:

http://server/FFLookup.svc HTTP://server/FFLookup.svc

I have 3.5 SP1 installed on the server. 我在服务器上安装了3.5 SP1。

What am I missing, and which "Server Logs" is it refering to? 我缺少什么,它指的是“服务器日志”? I can't find any further error messages. 我找不到任何进一步的错误消息。

There is nothing in the Event Viewer logs (System or Application), and nothing in the IIS logs other than the GET: 事件查看器日志(系统或应用程序)中没有任何内容,除了GET之外的IIS日志中没有任何内容:

2008-09-10 15:20:19 10.7.131.71 GET /FFLookup.svc - 8082 - 10.7.131.86 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-US)+AppleWebKit/525.13+(KHTML,+like+Gecko)+Chrome/0.2.149.29+Safari/525.13 401 2 2148074254 2008-09-10 15:20:19 10.7.131.71 GET /FFLookup.svc - 8082 - 10.7.131.86 Mozilla / 5.0 +(Windows; + U; + Windows + NT + 5.1; + en-US)+ AppleWebKit / 525.13 +(KHTML,+ like + Gecko)+ Chrome / 0.2.149.29 + Safari / 525.13 401 2 2148074254

There is no stack trace returned. 没有返回堆栈跟踪。 The only response I get is the "Request Error" as noted above. 我得到的唯一回应是如上所述的“请求错误”。

Thanks 谢谢

Patrick 帕特里克

In order to verbosely display the errors resulting from your data service you can place the following tag above your dataservice definition: 为了详细显示数据服务产生的错误,您可以将以下标记放在数据服务定义之上:

[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]  

This will then display the error in your browser window as well as a stack trace. 然后,这将在浏览器窗口中显示错误以及堆栈跟踪。

In addition to this dataservices throws all exceptions to the HandleException method so if you implement this method on your dataservice class you can put a break point on it and see the exception: 除此之外,dataservices还会抛出HandleException方法的所有异常,因此如果在dataservice类上实现此方法,则可以在其上设置断点并查看异常:

protected override void HandleException(HandleExceptionArgs e)
{
  try
  {
    e.UseVerboseErrors = true;
  }
  catch (Exception ex)
  {
    Console.WriteLine(ex.Message);
  }
}

Well I found the "Server Logs" mentioned in the error above. 好吧,我发现上面的错误中提到的“服务器日志”。

You need to turn on tracing in the web.config file by adding the following tags: 您需要通过添加以下标记来打开web.config文件中的跟踪:

    <system.diagnostics>
      <sources>
        <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing" >
            <listeners>
                <add name="ServiceModelTraceListener"/>
            </listeners>
        </source>

        <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"        >
            <listeners>
                <add name="ServiceModelTraceListener"/>
            </listeners>
        </source>
        <source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing">
            <listeners>
                <add name="ServiceModelTraceListener"/>
            </listeners>
        </source>
    </sources>
    <sharedListeners>
        <add initializeData="App_tracelog.svclog"   
                        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                        name="ServiceModelTraceListener" traceOutputOptions="Timestamp"/>
    </sharedListeners>
</system.diagnostics>

This will create a file called app_tracelog.svclog in your website directory. 这将在您的网站目录中创建一个名为app_tracelog.svclog的文件。

You then use the SvcTraceViewer.exe utility to view this file. 然后,使用SvcTraceViewer.exe实用程序查看此文件。 The viewer does a good job of highlighting the errors (along with lots of other information about the communications). 观众可以很好地突出显示错误(以及有关通信的大量其他信息)。

Beware: The log file created with the above parameters grows very quickly. 注意:使用上述参数创建的日志文件增长非常快。 Only turn it on during debuging! 只有在调试期间打开它!

In this particular case, the problem ended up being the incorrect version of OraDirect.Net, our Oracle Data Provider. 在这种特殊情况下,问题最终成为我们的Oracle数据提供商OraDirect.Net的错误版本。 The version we were using did not support 3.5 SP1. 我们使用的版本不支持3.5 SP1。

For me the error was caused by two methods having the same name (unintended overloading). 对我来说,错误是由两个具有相同名称的方法(意外重载)引起的。

Overloading is not supported but type 'abc' has an overloaded method 'Void SubmitCart(System.String, Int32)'. 不支持重载,但类型'abc'有一个重载方法'Void SubmitCart(System.String,Int32)'。

I found out by running the service in debug mode. 我通过在调试模式下运行服务找到了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM