DotNetShipping 费率始终为空 - FedEx
DotNetShipping rates are always empty - FedEx
使用这个包裹,DotNetShipping,我的 FedEx 费率(我没有使用任何其他提供商)总是空的。做了一些谷歌搜索,我没有想出任何答案。
.NET 4
- 地址 1(地址对象的第一个参数)确实有一个有效的
地址。
- 没有错误。
- FedEx 帐户已创建,(4) 个变量来自
web.config 具有正确的值。
测试代码:
public string fedexKey = ConfigurationManager.AppSettings["FedExKey"];
public string fedexPassword = ConfigurationManager.AppSettings["FedExPassword"];
public string fedexAccountNumber = ConfigurationManager.AppSettings["FedExAccountNumber"];
public string fedexMeterNumber = ConfigurationManager.AppSettings["FedExMeterNumber"];
public decimal Test()
{
var packages = new List<Package>();
packages.Add(new Package(12, 12, 12, 35, 150));
packages.Add(new Package(4, 4, 6, 15, 250));
var origin = new DotNetShipping.Address("address here", string.Empty, string.Empty, "Cary", "North Carolina", "27513", "US");
var destination = new DotNetShipping.Address("address here", string.Empty, string.Empty, "Smyrna", "Georgia", "30082", "US"); // US Address
var rateManager = new RateManager();
rateManager.AddProvider(new FedExProvider(fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber));
DotNetShipping.Shipment shipment = rateManager.GetRates(origin, destination, packages);
foreach (Rate rate in shipment.Rates) // Rates are empty
{
var p = rate;
}
return 0;
}
我确实有 FedEx API 的文档,我查看了包裹中的 code,它看起来很相似。
如果有更好的免费运费套餐,我也会尝试使用它。
下载源码调试后,需要注意的是,测试时,将useProduction
设置为false
=\
rateManager.AddProvider(new FedExProvider(fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber, false));
使用这个包裹,DotNetShipping,我的 FedEx 费率(我没有使用任何其他提供商)总是空的。做了一些谷歌搜索,我没有想出任何答案。
.NET 4
- 地址 1(地址对象的第一个参数)确实有一个有效的 地址。
- 没有错误。
- FedEx 帐户已创建,(4) 个变量来自 web.config 具有正确的值。
测试代码:
public string fedexKey = ConfigurationManager.AppSettings["FedExKey"];
public string fedexPassword = ConfigurationManager.AppSettings["FedExPassword"];
public string fedexAccountNumber = ConfigurationManager.AppSettings["FedExAccountNumber"];
public string fedexMeterNumber = ConfigurationManager.AppSettings["FedExMeterNumber"];
public decimal Test()
{
var packages = new List<Package>();
packages.Add(new Package(12, 12, 12, 35, 150));
packages.Add(new Package(4, 4, 6, 15, 250));
var origin = new DotNetShipping.Address("address here", string.Empty, string.Empty, "Cary", "North Carolina", "27513", "US");
var destination = new DotNetShipping.Address("address here", string.Empty, string.Empty, "Smyrna", "Georgia", "30082", "US"); // US Address
var rateManager = new RateManager();
rateManager.AddProvider(new FedExProvider(fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber));
DotNetShipping.Shipment shipment = rateManager.GetRates(origin, destination, packages);
foreach (Rate rate in shipment.Rates) // Rates are empty
{
var p = rate;
}
return 0;
}
我确实有 FedEx API 的文档,我查看了包裹中的 code,它看起来很相似。
如果有更好的免费运费套餐,我也会尝试使用它。
下载源码调试后,需要注意的是,测试时,将useProduction
设置为false
=\
rateManager.AddProvider(new FedExProvider(fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber, false));