Tag: web services

无法加载文件或程序集exception

有关可能导致此exception的原因的任何想法? 我有一个webservice proj,当我加载我得到的链接 无法加载文件或程序集“Interop.DIB”或其依赖项之一。 尝试加载格式不正确的程序。 exception详细信息:System.BadImageFormatException:无法加载文件或程序集“Interop.DIB”或其依赖项之一。 尝试加载格式不正确的程序。 内部exception: [BadImageFormatException:无法加载文件或程序集“Interop.DIB”或其依赖项之一。 试图加载格式不正确的程序。] [ConfigurationErrorsException:无法加载文件或程序集“Interop.DIB”或其依赖项之一。 试图加载格式不正确的程序。] [HttpException(0x80004005):无法加载文件或程序集“Interop.DIB”或其依赖项之一。 试图加载格式不正确的程序。] 版本信息: Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.272

为什么静态方法不能用作ASMX Web服务中的Web服务操作?

我只是想知道为什么我不能在Web服务中使用静态Web方法? 为什么限制? 有些遗体可以给我简明扼要的解释。

使用WS-Security UsernameToken PasswordDigest身份validation方案的WCF客户端使用Axis 2 Web服务时出错

我有一个WCF客户端连接到基于Java的Axis2 Web服务(在我的控制之外)。 它即将应用WS-Security,我需要修复.NET客户端。 但是,我正在努力提供正确的身份validation。 我知道WSE 3.0可能会让它变得更容易,但我宁愿不再使用过时的技术。 类似的问题(未解决),包括这个 , 这个和这个 。 SOAP消息应如下所示: 2010-05-28T12:50:33.675+01:00 但是,我的看起来像这样: 2010-06-23T10:31:23.441Z 2010-06-23T10:36:23.441Z 我的客户端看起来像这样:PS注意所需的 SecurityHeaderType参数。 那是什么? public MyAck SendRequest(MyRequest request) { RemoteServicePortTypeClient client = new RemoteServicePortTypeClient(); client.ClientCredentials.UserName.UserName = “JAY”; client.ClientCredentials.UserName.Password = “AND”; // what is the difference between the two different Credential types?? //client.ClientCredentials.HttpDigest.ClientCredential.UserName = “SILENT”; //client.ClientCredentials.HttpDigest.ClientCredential.Password = “BOB”; SecurityHeaderType sht = new […]

让POST端点在自托管(WebServiceHost)C#webservice中工作?

所以,我一直在搞乱webservices一段时间,我不断回到一些基础知识,我似乎永远不会对。 问题1: 在.NET / C#中使用WebServiceHost时,可以使用GET / POST / etc定义方法/端点。 设置GET方法很简单,它可以直接工作,并且很容易理解它是如何工作的。 例如: [OperationContract] [WebInvoke(Method = “GET”, UriTemplate = “/PutMessage/{jsonString}”, BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] string PutMessage(string jsonString); 如果我调用http:/// MyWebService / PutMessage / {MyJsonString},我会传递该方法,并且一切都很好(或多或少)。 但是,当我将其定义为POST时,这意味着什么呢? [OperationContract] [WebInvoke(Method = “POST”, UriTemplate = “/PutMessage/{jsonString}”, BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] string PutMessage(string […]

Asp.Net Web服务:我想返回错误403禁止

我有一个在c#/ asp.net中编程的Web服务。 [WebService(Namespace = “http://example.com/”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService] [System.ComponentModel.ToolboxItem(false)] public class Service: System.Web.Services.WebService { [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public Result GetData() { User user = GetUser(); if (user.LoggedIn) { return GetData(); } else { // raise exception -> return error 403 } } 如何从此Web服务返回错误403? 我可以抛出exception – 但这显示了exception,而不是他的错误。 有任何想法吗?

如何将标头中的用户名/密码传递给SOAP WCF服务

我正在尝试使用第三方Web服务https://staging.identitymanagement.lexisnexis.com/identity-proofing/services/identityProofingServiceWS/v2?wsdl 我已将其添加为服务引用,但我不确定如何传递标头的凭据。 如何使标头请求与此格式匹配? 12345/userID password123 d+VxCZX1cH/ieMkKEr/ofA== 2012-08-04T20:25:04.038Z

我是否可以为ASP.NET SOAP Web服务提供可选参数

我想用这个签名构建一个web服务,如果param2留空,它不会抛出exception。 这可能吗? [WebMethod] public string HelloWorld(string param1, bool param2) { } exception是在尝试将空字符串转换为布尔值时抛出的System.ArgumentException。 到目前为止没有奏效的想法: Web服务不允许使用方法重载,例如 public string HelloWorld(string param1) { return HelloWorld(param1, false); } 如下所示: 让bool自杀的bool? 。 同样的例外。 操纵WSDL,看到这个答案 我的问题与这个问题有关 ,但唯一的答案是WCF合同,我还没有使用过。

.NET 4.5中的序列化中断

我们有一个只在.NET 4.5中发生的序列化问题 – 相同的代码在.NET 4中工作正常。我们试图用几个字段序列化一个inheritance的类型,基类和inheritance类都用SerializableAttribute标记。 我们在Web服务的客户端获得一个exception,说服务器中有一个MethodAccessException ,服务器本身不会抛出任何exception,这似乎是客户端序列化过程中的一个问题。 重要的是要注意我们在.NET 4-而不是.4.5中进行编译 更新:实现ISerailize并忽略“Value”属性后,程序运行正常,但这意味着我们不得不放弃序列化此字段。 非常感激任何的帮助。 谢谢,奥梅尔 例外细节: System.Web.Services.Protocols.SoapException occurred HResult=-2146233087 Message=System.Web.Services.Protocols.SoapException: Server was unable to process request. —> System.InvalidOperationException: There was an error generating the XML document. —> System.MethodAccessException: Attempt by method ‘Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write88_DeviceSiteTypeInfo(System.String, System.String, IOSIGHT.Info.DeviceSiteTypeInfo, Boolean, Boolean)’ to access method ‘IOSIGHT.Info.DeviceSiteTypeInfo.get_Value()’ failed. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write88_DeviceSiteTypeInfo(String n, String ns, DeviceSiteTypeInfo o, […]

ef4导致Web服务中的循环引用

我有一个Reason对象: public class Reason { public virtual long Id { get; set; } public virtual string Name { get; set; } public virtual Company Company {get;set;} } 我使用entity framework4,公司是公司的导航属性。 我还使用webservices将数据返回给客户端。 我有web方法返回原因: [WebMethod] public Reason[] GetCallReasons() { IReasonRepository rep = ObjectFactory.GetInstance(); return rep.GetReasonsList().ToArray(); } 由于ef4,我在执行web方法时遇到以下exception: A circular reference was detected while serializing an object of type […]