草庐IT

request-object

全部标签

c# - "The request failed with an empty response"调用网络服务时

当从aspx页面调用托管在服务器中的网络服务时,我收到类似“请求失败,响应为空”的错误。我页面中的代码try{HttpWebRequestrequest1=(HttpWebRequest)WebRequest.Create("https://login.erp.com/rodeprovisioning/provisioning.asmx");request1.Accept="text/xml";request1.Method="POST";WebProxyproxyObject=newSystem.Net.WebProxy("http://10.0.0.1:8080/",true);r

c# - SQLException (0x80131904) : Invalid object name 'dbo.Categories'

我在运行应用程序时遇到上述异常。该应用程序正在使用asp.netmvc3/C#。我制作了一个mdf文件并将其添加到VisualWebDeveloperExpress的App_Data文件夹下。我将连接字符串添加到web.config文件夹,但是当我运行并浏览到/store时,我收到上面的错误,并突出显示varcategories=storeDB.Categories.ToList();行。我的数据库包含6个表,其中一个是类别。Controller:EventCalendarEntitiesstoreDB=newEventCalendarEntities();publicActionRe

c# - 在 'object' 上找不到 WPF/XAML 属性

我在一个新的WPF应用程序中使用BackgroundWorker,我需要在它在后台工作时报告进度/更新UI。我在WIndowsForms应用程序中已经这样做了很长时间。我刚刚为WPF重写了这一切,这让我有点头疼。它在运行时不断抛出以下错误:System.Windows.DataError:40:BindingExpressionpatherror:'Sender'propertynotfoundon'object'''Char'(HashCode=5046349)'.BindingExpression:Path=Sender;DataItem='Char'(HashCode=50463

c# - EF 5 代码迁移错误 : "There is already an object named _____ in the database"

在进行EF5代码迁移时遇到了一个反复出现的奇怪问题,现在让我无法工作。尝试运行update-database并收到此错误:Thereisalreadyanobjectnamed'RequestStatus'inthedatabase.详细的日志转储:PM>update-database-vUsingStartUpproject'LicensingWorkflow'.UsingNuGetproject'LicensingWorkflow'.Specifythe'-Verbose'flagtoviewtheSQLstatementsbeingappliedtothetargetdataba

c# - LinqToSQL 错误 : Operation is not valid due to the current state of the object

在更新命令期间,我收到以下错误:Operationisnotvalidduetothecurrentstateoftheobject我试图从更新命令中删除一列并且它工作正常。此列是一个FK,与其他工作正常的FK相似。这是执行更新的代码:ti.NumeroTitolo=titolo.Numero;ti.RKTipoTitoloGenereTitolo=titolo.RkTipoTitoloGenereTitolo;ti.RKBanca=titolo.RkBanca;ti.DataScadenza=titolo.DataScadenza;ti.RKTipoEsito=titolo.RkTi

c# - Entity Framework 6 : Adding child object to parent's list vs. 将子项的导航属性设置为父项

我有一个现有数据库,其中包含两个表MailServers和MailDomains。MailDomains的外键列MailServerId指向MailServers中的Id主键列。所以我们这里是一对多的关系。我关注了thisarticle并通过实体数据模型向导中的“代码优先从数据库”模型创建了我的EntityFrameworkPOCO。这产生了以下两个C#类:publicpartialclassMailServer{publicMailServer(){MailDomains=newHashSet();}publicintId{get;set;}publicvirtualICollect

c# - "Unable to cast object of type ' System.Net.Http.Formatting.JsonContractResolver ' to type ' Newtonsoft.Json.Serialization.DefaultContractResolver '."

我们有一个最近被转移到新服务器的WEBAPI项目。在对项目的有效负载进行一些添加后,我正在运行我的项目,但它突然抛出以下错误:Unabletocastobjectoftype'System.Net.Http.Formatting.JsonContractResolver'totype'Newtonsoft.Json.Serialization.DefaultContractResolver'.有问题的代码行在global.asax中:protectedvoidApplication_Start(){GlobalConfiguration.Configure(WebApiConfig.R

c# - Request.QueryString[] 对比 Request.Query.Get() 对比 HttpUtility.ParseQueryString()

我搜索了SO并发现了类似的问题,但没有一个比较这三个问题。这让我很吃惊,所以如果有人知道,请指点一下。有许多不同的方法来解析请求的查询字符串……“正确”的方法(IMO)应该处理空值/缺失值,但也要适本地解码参数值。以下哪项是同时做到这两点的最佳方式?方法一stringsuffix=Request.QueryString.Get("suffix")??"DefaultSuffix";方法2stringsuffix=Request.QueryString["suffix"]??"DefaultSuffix";方法三NameValueCollectionparams=HttpUtility.

c# - 在 Protobuf.NET 中序列化 List<object> (其中对象支持原语)?

如何使用protobuf-net序列化这样的对象:publicclassMyObject{publicstringKey{get;set;}publicListValues{get;set;}}当我尝试使用TypeModelprotobuf-net对此进行序列化时,抛出一个错误,指出它不知道如何序列化System.Object。现在我知道Values只会包含基元(int、string、float、DateTime等)。那么如何让protobuf-net知道这一点呢? 最佳答案 在任何意义上,这在纯ProtoBuf中都是不可行的。Pr

c# - SOAP 错误 : "Server was unable to process request" "Object reference not set to an instance of an object"

当我向本地IIS中的服务发送SOAP请求时,一切正常。当我向在另一台主机上的IIS上运行的同一服务发送SOAP请求时,一切正常。但是当另一个程序员向我的服务发送SOAP请求时,他通常会得到正确的响应,除了返回服务中的一个方法:soap:ServerServerwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.我需要了解他收到此错误的原因。他的SOAP请求与SOAP请求完全相同,但我的有效,而他的无效。 最佳答案 如果您不确切知道错