当前位置: 代码迷 >> ASP.NET >> webserver的“text/html;charset=utf-8”,但应为“text/xml”异常
  详细解决方案

webserver的“text/html;charset=utf-8”,但应为“text/xml”异常

热度:2954   发布时间:2013-02-25 00:00:00.0
webserver的“text/html;charset=utf-8”,但应为“text/xml”错误
今日把添加了一个方法后的webserve重新生成后发布上去,在调用的网页使用。这时,当使用原来的老方法的引用是报出异常

“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------

客户端发现响应内容类型为“text/html; charset=utf-8”,但应为“text/xml”。
请求失败,错误信息为:
--
<html>
  <head>
  <title>Parser Error</title>
  <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:"Lucida Console";font-size: .9em}
  .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; }
  </style>
  </head>

  <body bgcolor="white">

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

  <h2> <i>Parser Error</i> </h2></span>

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

  <b> Description: </b>An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
  <br><br>

  <b> Parser Error Message: </b>Could not create type 'SpService'.<br><br>

  <b>Source Error:</b> <br><br>

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

<font color=red>Line 1: <%@ WebService Language="C#" CodeBehind="SpService.cs" Class="SpService" %>
</font></pre></code>

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

  <br>

  <b> Source File: </b> /spService.asmx<b> Line: </b> 1
  <br><br>

  <hr width=100% size=1 color=silver>

  <b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

  </font>

  </body>
</html>
<!-- 
[HttpParseException]: Could not create type 'SpService'.
  at System.Web.UI.SimpleWebHandlerParser.GetType(String typeName)
  at System.Web.UI.SimpleWebHandlerParser.GetTypeToCache(Assembly builtAssembly)
  at System.Web.Compilation.SimpleHandlerBuildProvider.GetGeneratedType(CompilerResults results)
  at System.Web.Compilation.BuildProvider.CreateBuildResult(CompilerResults results)
  at System.Web.Compilation.BuildProvider.GetBuildResult(CompilerResults results)
  at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
  at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
  相关解决方案