4

我试图弄清楚为什么会这样。它超级奇怪

以下是我的确切电话。每当我在车辆数据合同的末尾添加那个额外的数据成员时,我都会得到远程服务器返回一个错误:NotFound。当调用 pick.SaveVehiclesAsync(infoKey, data);

从银光边

public void SaveVehicles(InfoKey infoKey, ObservableCollection<VehicleFullInfoModel> vehicleFullInfoCollection, EventHandler<SaveVehiclesEventArgs> callBack)
    {
        var pick = new **ProjectServiceClient**();
        pick.SaveVehiclesCompleted += (sender, e) =>
        {
            if (callBack != null)
                callBack(this, new SaveVehiclesEventArgs(e.Result, e.fault));
        };
        var data =
            new ObservableCollection<VehicleFullInfo>(vehicleFullInfoCollection.Select(rec => rec.Data).ToList());
        pick.SaveVehiclesAsync(infoKey, data);
    }

------------- 来自 WCF 服务

public interface IProjectService
{
    [OperationContract]
    string SaveVehicles(InfoKey infoKey, IList<VehicleFullInfo> vehicleFullInfoCollection, out FaultContract fault);
}
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ProjectService : IProjectService
{
    public string SaveVehicles(InfoKey infoKey, IList<VehicleFullInfo> vehicleFullInfoCollection, out FaultContract fault)
    {      
        return PickVehicles.SaveVehicles(infoKey, vehicleFullInfoCollection,  out fault);
    }
}

--------- PickVehicles 类------

保存到文件

------------ 数据契约

[DataContract]
public class VehicleFullInfo
{
    [DataMember]
    public Vehicle Vehicle { get; private set; }
}

------ 车辆数据合同

[DataContract]
public class Vehicle
{
    public Vehicle(Data vehicleData, int index)
    {

    }

    [DataMember]
    public string VehicleNumber { get; set; }

    [DataMember]
    public bool? IsVehicleFromPolicy { get; private set; }

    [DataMember]
    public bool? IsInclude { get; set; }

    [DataMember]
    public string VIN { get; set; }

    [DataMember]
    public VehicleTypeEnum Type { get; set; }

    [DataMember]
    public int? ModelYear { get; set; }

    [DataMember]
    public VehicleMake Make { get; set; }

    [DataMember]
    public string Model { get; set; }

    [DataMember]
    public bool? HasAntiTheft { get; set; }

    [DataMember]
    public AirBagTypeEnum AirBagType { get; set; }

    [DataMember]
    public int? GarageZip { get; set; }

    [DataMember]
    public VehicleUseTypeEnum VehicleUseType { get; set; }

    [DataMember]
    public int? Miles { get; set; }

    [DataMember]
    public int? TrailerValue { get; set; }

    [DataMember]
    public bool? IsMotorhomeSold { get; set; }

    [DataMember]
    public int? TrailerCamperLength { get; set; }

    [DataMember]
    public string TrailerDesc { get; set; }

    [DataMember]
    public int? TrailerGrossWeight { get; set; }

    [DataMember]
    public string ExtraField { get; set; }
}
4

4 回答 4

3

Not Found是 Silverlight 上的一般错误,这可能意味着很多事情 - 跨域问题、来自网络的任何非 200 响应等。您可以做一些事情,例如在服务器端启用跟踪,或查看使用诸如 Fiddler 之类的工具来处理网络流量,这将为您提供有关错误的更多信息。

http://blogs.msdn.com/b/silverlightws/archive/2008/04/16/debugging-web-service-usage-in-silverlight-2.aspx上的帖子有一些在调试 WCF 调用时很有用的信息银光制作。

于 2013-04-09T22:36:20.543 回答
1

大多数情况下会发生此错误,只需右键单击每次在时钟附近运行应用程序时打开的 ASP.NET IIS 服务器图标并停止它。

然后再试一次。

于 2013-04-09T22:53:03.273 回答
0

尝试在服务器配置文件的端点设置绑定配置 - 示例:

 <endpoint
           address=""
           binding="pollingDuplexHttpBinding"
           bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
           contract="DuplexService.IDuplexService">
</endpoint>

但当然,您必须配置相应的绑定 - 例如:

<bindings>
        <pollingDuplexHttpBinding>
          <binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
                   duplexMode="MultipleMessagesPerPoll"
                   maxOutputDelay="00:00:07"/>
        </pollingDuplexHttpBinding>
</bindings>

祝你好运。

于 2013-09-27T22:36:49.023 回答
0

确保您的 wcf 已启用跟踪。这通常是导致我遇到问题的原因,这次也是如此。

于 2019-07-30T15:00:44.000 回答