简体   繁体   English

C#-Visual Studio 2012的WebServiceHost问题

[英]C# - WebServiceHost issue with Visual Studio 2012

I am using a WebServiceHost to receive a command object and return a response to a client. 我正在使用WebServiceHost接收命令对象并将响应返回给客户端。

I have datacontracts setup for the objects and the client is executed using HttpWebRequest and HttpWebResponse objects. 我为对象设置了数据合同,并使用HttpWebRequest和HttpWebResponse对象执行了客户端。

This has all been working fine for two application versions, and still works fine on machines that have never had Visual Studio 2012 installed. 对于两个应用程序版本,这一切都可以正常工作,并且在从未安装过Visual Studio 2012的计算机上仍然可以正常工作。

I have a test machine I installed Visual Studio 2012 on to debug the client to server interaction and try out VS2012 at the same time. 我有一台安装了Visual Studio 2012的测试机,用于调试客户端与服务器的交互并同时尝试VS2012。 As soon as VS2012 was installed the WebServiceHost stopped working. VS2012一经安装,WebServiceHost便停止工作。 The client receives 404 errors if its attempting to send commands to the machine with VS2012 or if the client itself is on VS2012 I get the same error. 如果客户端尝试使用VS2012向计算机发送命令,或者客户端本身在VS2012上,则客户端会收到404错误,我会收到相同的错误。 This happens in debug, release, and built versions of the application. 这发生在应用程序的调试,发行和内部版本中。 Including versions that have been released and work on other machines. 包括已发布并且可以在其他计算机上使用的版本。

Once I narrowed down the issue to the machine with Visual Studio 2012 I did some searching to no avail. 当我将问题缩小到使用Visual Studio 2012的计算机时,我做了一些搜索都无济于事。 So I uninstalled Visual Studio 2012, 404's still received. 因此,我卸载了Visual Studio 2012,但仍收到404。 Uninstalled .Net Framework 4.5 and reinstalled 4.0, 404's still received. 卸载.Net Framework 4.5并重新安装4.0,仍然收到404。 Uninstalled and reinstalled application, 404's still received. 卸载并重新安装的应用程序仍收到404。 I have ensured firewalls are disabled on both client and server. 我确保客户端和服务器上的防火墙都被禁用。

I'm thinking it probably is related to the VS2012 machine failing to serialize and deserialize the command object to and from xml. 我认为这可能与VS2012计算机无法将命令对象与xml进行序列化和反序列化有关。 But what VS2012 dependency could mess that up is what I cant seem to find. 但是,VS2012依赖项可能会弄乱我似乎找不到的东西。

I'm at the point now where I'm ready to re-image the test machine, but that won't help me if I ever want to use Visual Studio 2012 in the future. 现在,我可以对测试机进行重新映像了,但是如果将来我想使用Visual Studio 2012,那将无济于事。

Thanks for any help or direction you can provide. 感谢您提供的任何帮助或指示。

This turned out to be a problem on the client side. 事实证明这是客户端的问题。 The configured URI for the WebServiceHost contained a "commands/" qualifier. 为WebServiceHost配置的URI包含“ commands /”限定符。 Before installing .Net 4.5 the WebServiceHost was responding to requests without the "commands/" but once it was updated it no longer would. 在安装.Net 4.5之前,WebServiceHost响应的请求不带“ commands /”,但是一旦更新,它就不再响应。 Not really sure why this is but it did correct the issue. 不太确定为什么会这样,但确实解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM