访问我的Web服务时出现问题 [英] Problems accessing my web services

查看:111
本文介绍了访问我的Web服务时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我迷路了...完全!

我有一个控制台应用程序,在几周前运行良好,现在,突然之间,我无法正常运行.它使用我构建的Web服务来访问一些我已经证实能正常工作的数据库(尽管它们都是基于Web的,但我也在其他几个应用程序中使用了它.)

当我调用Web服务(称为dnc2ws)时:

Hi all

I am lost ... completely!

I have a console application that was working fine a few weeks ago and now, suddenly, I can''t get it to work. It uses a web service I built to access some databases which I have confirmed works fine (I use it in several other applications, albeit they''re all web-based).

When I call the web service (referenced as dnc2ws):

dnc2ws.dnc2ws dncws = new dnc2ws.dnc2ws();



我明白了:



I get this:

System.Reflection.TargetInvocationException was unhandled
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
       at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
       at System.Activator.CreateInstance(Type type, Boolean nonPublic)
       at System.Xml.Serialization.TempAssembly.LoadGeneratedAssembly(Type type, String defaultNamespace, XmlSerializerImplementation& contract)
       at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
       at System.Web.Services.Protocols.SoapClientType..ctor(Type type)
       at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
       at BGService.dnc2ws.dnc2ws..ctor() in C:\exco\DNC-2\Prototype\DNC2\BGService\Web References\dnc2ws\Reference.cs:line 124
       at BGService.BGService..ctor() in C:\exco\DNC-2\Prototype\DNC2\BGService\BGService.cs:line 29
       at BGService.Program.Main() in C:\exco\DNC-2\Prototype\DNC2\BGService\Program.cs:line 27
  InnerException: System.Runtime.InteropServices.COMException
       Message=A procedure imported by ''C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'' could not be loaded.
       Source=BGService.XmlSerializers
       ErrorCode=-2147024769
       StackTrace:
            at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract..ctor()
       InnerException: 



我已经尝试撤消了过去几周对Web服务所做的更改,但这并没有改变.我已经确认该Web服务可以正常工作(我已经有几个使用它的Web应用程序了.).

有人可以帮我吗?我已经来过这几天了!

谢谢,
Peter



I''ve tried backing out the changes to the web service that I''ve done over the last few weeks but that doesn''t make a difference. I''ve confirmed that the web service works (I have a couple web apps consuming it already).

Can someone help me out? I''ve been at this for days!

Thanx,
Peter

推荐答案

您是否还有其他客户端在访问Web服务?您可能要创建一个虚拟客户端,向该客户端添加新引用,然后尝试访问Web服务器.如果可行,请尝试在现有客户端中使用该代理类.基于此,您可以缩小问题范围.另外,这可能有点不合时宜,但是您的客户端是否具有足够的安全性来访问Web服务器(尽管我认为这可能不是问题).实例化Web参考时出现错误的原因令人困惑.如果尝试访问Web方法时发生了这种情况,那将很容易.
Do you have any other client accessing the web service? You might want to create a dummy client, add a new reference to the client and try accessing the web server. If that works, try to use that proxy class in your existing client. Based on that you can narrow down on what might be the issue. Also, this might be a bit out of the line, but does your client have enough security to access the web server (though I do not think this might be the issue). The reason that you are getting the error while instantiating the web refernce is puzzling. If it was happening while trying to access a web mthod, it would have been easire.


它可能与Web服务完全无关.由于您说的是Web服务可以正常运行,因此可能是由于其他一些问题.您是否尝试检查代理类是否损坏.您可以尝试重新设置代理,然后重试.另外,请检查其他任何客户端在使用相同的代理类时是否遇到相同的问题.

另外,您是否引用了GAC中的任何程序集?
It might not have to do with the web service at all. Since you are saying that the web service works fine, it could be due to some other issue. Did you try and check to see if the proxy class got corrupted. You can try and renegerate the proxy and try again. Also, check if any other client is having the same problem with the same proxy class.

Also, are you referencing any assembly from GAC?


感谢您的回应.实际上,我完全删除了对该服务的引用(及其生成的文件夹),并重新附加了它(几次),并遵循相同的思路.

至于从GAC引用程序集,我已经在项目中添加了几项:
Thanx for the response. I actually deleted the reference to the service completely (and the resulting folders) and reattached it (several times), thinking along the same lines.

As for referencing assemblies from the GAC, I have added a couple items to the project:
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Management" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />



这对您有没有帮助?

另外...我构建了一个完整的新虚拟机,以为我可能在其他环境中损坏了某些东西...因此,GAC中出现损坏的可能性很小.

感谢您的帮助!



Does that help you at all?

Also... I built a complete new virtual machine, thinking maybe I corrupted something in my other environment... so the likelihood of there being a corruption in the GAC would be slim.

I appreciate the help!


这篇关于访问我的Web服务时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆