【发布时间】:2016-08-29 20:49:26
【问题描述】:
我正在尝试在发布模式下运行我的项目,但遇到了一个问题:我立即崩溃,出现以下异常:
An unhandled exception of type 'System.ServiceModel.ProtocolException' occurred in
mscorlib.dll
Additional information: The content type text/html; charset=utf-8 of the response message
does not match the content type of the binding (text/xml; charset=utf-8). If using a
custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
The first 1024 bytes of the response were:
'<!DOCTYPE html>
<html>
<head>
<title>Could not load file or assembly 'MyNamespace.MySolution.MyProject'
or one of its dependencies. An attempt was made to load a program with an
incorrect format.
</title>
内部异常是(500) Internal Server Error.
我尝试在调试器中启动发布版本并在该错误发生之前单步执行代码,但我无法进一步执行代码 - 它不提供附加到服务器进程,只是抛出错误。我见过几个类似的问题,但似乎没有解决这个问题。如有任何建议,我将不胜感激。
【问题讨论】:
-
我不认为你可以调试发布版本代码(但我不是 100% 确定)。错误消息似乎很清楚 - “无法加载文件或程序集'MyNamespace.MySolution.MyProject'或其依赖项之一。尝试加载格式不正确的程序。”
-
您是否更改了运行时?可能您正在使用
Debug配置,即x86,而您的Release配置是x64。我敢打赌,或者你的依赖项之一就是这样设置的。 -
这可能不是真的,但以防万一:响应是html,但绑定是xml
标签: c# .net visual-studio wcf release