Problem rolling out ADO.Net Data Service application to IIS

删除回忆录丶 提交于 2019-12-02 20:51:36

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:

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:

    <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.

You then use the SvcTraceViewer.exe utility to view this file. 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. The version we were using did not support 3.5 SP1.

chitza

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)'.

I found out by running the service in debug mode.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!