C# 首次连接时附加到rest服务xml结果的运行时错误

C# 首次连接时附加到rest服务xml结果的运行时错误,c#,wcf,rest,C#,Wcf,Rest,我在WCF REST(GET和POST)服务上实现了不同的类型。 之前所有的服务工作正常,我得到的结果格式正确(XML格式)。 在all Get服务中,我以XML格式返回结果。 当我一天中第一次访问服务时,下面的错误会附加到结果xml中。 我得到了预期的xml结果,但为什么会附加上面的运行时错误,并且它只在第一次连接到服务器时发生 早些时候,它工作正常,但在我们的服务器移动后,我面临这个问题 你能帮我解决这个问题吗 <!DOCTYPE html> <html>

我在WCF REST(GET和POST)服务上实现了不同的类型。 之前所有的服务工作正常,我得到的结果格式正确(XML格式)。 在all Get服务中,我以XML格式返回结果。 当我一天中第一次访问服务时,下面的错误会附加到结果xml中。 我得到了预期的xml结果,但为什么会附加上面的运行时错误,并且它只在第一次连接到服务器时发生 早些时候,它工作正常,但在我们的服务器移动后,我面临这个问题 你能帮我解决这个问题吗

<!DOCTYPE html>
 <html>
    <head>
        <title>Runtime Error</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>Runtime Error</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
            <br><br>

            <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

&lt;!-- Web.Config Configuration File --&gt;

&lt;configuration&gt;
    &lt;system.web&gt;
        &lt;customErrors mode=&quot;Off&quot;/&gt;
    &lt;/system.web&gt;
&lt;/configuration&gt;</pre></code>

                  </td>
               </tr>
            </table>

            <br>

            <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application&#39;s &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

&lt;!-- Web.Config Configuration File --&gt;

&lt;configuration&gt;
    &lt;system.web&gt;
        &lt;customErrors mode=&quot;RemoteOnly&quot; defaultRedirect=&quot;mycustompage.htm&quot;/&gt;
    &lt;/system.web&gt;
&lt;/configuration&gt;</pre></code>

                 </td>
               </tr>
            </table>
            <br>
        </body>
</html>

运行时错误
正文{字体系列:“Verdana”;字体重量:正常;字体大小:.7em;颜色:黑色;}
p{字体系列:“Verdana”;字体大小:正常;颜色:黑色;页边顶部:-5px}
{字体系列:“Verdana”;字体大小:粗体;颜色:黑色;页边顶部:-5px}
H1{字体系列:“Verdana”;字体重量:正常;字体大小:18pt;颜色:红色}
H2{字体系列:“Verdana”;字体重量:正常;字体大小:14pt;颜色:褐红色}
前{字体系列:“控制台”,“Lucida控制台”,单空格;字体大小:11pt;边距:0;填充:0.5em;线条高度:14pt}
.marker{字体大小:粗体;颜色:黑色;文本装饰:无;}
.version{color:gray;}
.错误{页边距底部:10px;}
.expandable{文本装饰:下划线;字体大小:粗体;颜色:海军蓝;光标:手;}
@媒体屏幕和屏幕(最大宽度:639px){
pre{width:440px;溢出:自动;空白:预换行;换行:断开单词;}
}
@媒体屏幕和屏幕(最大宽度:479px){
前{宽度:280px;}
}
“/”应用程序中出现服务器错误。
运行时错误 描述:服务器上发生应用程序错误。此应用程序的当前自定义错误设置阻止远程查看应用程序错误的详细信息(出于安全原因)。但是,本地服务器上运行的浏览器可以查看它。

详细信息:要在远程计算机上查看此特定错误消息的详细信息,请在当前web应用程序根目录中的“web.config”配置文件中创建customErrors标记。然后,此customErrors标记的“mode”属性应设置为“Off”。


!-- Web.Config配置文件--
配置
system.web
customErrors mode=“关闭”/
/system.web
/配置

注意:通过修改应用程序的“defaultRedirect”属性',可以用自定义错误页替换当前看到的错误页;s customErrors配置标记指向自定义错误页面URL。


!-- Web.Config配置文件--
配置
system.web
customErrors mode=“RemoteOnly”defaultRedirect=“mycustompage.htm”/
/system.web
/配置


这一点相当模糊:比所有服务都要早;您如何访问服务(代码)?您尚未包含错误消息。你说服务器“移动”是什么意思?我们的生产服务器配置在新机器上,我们无法访问Proction服务器。我说的
code
,是指调用服务并失败的代码。你是说你只是浏览了一下服务,发现了这个错误?您能在服务器的应用程序日志中看到任何内容吗?如果您在本地计算机上设置了这些服务,会发生什么情况?在旧服务器配置中,服务工作正常,在配置新服务器后,我们会发现xml格式的结果是正确的,但某些Doctype HTMl内容(运行时错误-如上所述)当我在一天中第一次浏览服务时,html运行时被附加到结果中,作为我从服务器得到的响应,并且没有登录服务器。