代码改变世界

开发错误处理记录(IIS ODP.NET 64位)

2012-03-30 09:30  java线程例子  阅读(356)  评论(0编辑  收藏  举报

这两天在调试原来的程序时,调用WCF服务出现如下错误:

{"远程服务器返回错误: (500) 内部服务器错误。"}

错误信息如下:

响应消息的内容类型 text/html; charset=utf-8 与绑定(text/xml; charset=utf-8)的内容类型不匹配。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。响应的前 1024 个字节为:“<!DOCTYPE html>
<html>
    <head>
        <title>未能加载文件或程序集“Oracle.DataAccess”或它的某一个依赖项。试图加载格式不正确的程序。</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;”。

因为原来程序是可以的,不过原来的环境是windows2003,现在环境是Windows2008(64),WCF服务是IIS寄宿的,开始怀疑程序问题,如是直接访问调试环境下的WCF服务,没问题。于是直接在IE中访问WCF服务,提示:

未能加载文件或程序集“Oracle.DataAccess”或它的某一个依赖项。试图加载格式不正确的程序

开始怀疑是版本问题,但别的机器上都可以。后来在网上搜到解决此类型的方法,总结如下:

64位IIS应用程序池,默认是不加载32位应用程序集的,我的Oracle.DataAccesss.dll是32位的,需按下面进行修改:

做上述调整后问题解决。

PS:64位下,IIS的设置还是有很大的区别,把解决的问题都记下来,积累经验。