我正在开发一个三层架构的拍卖网站。在AuctionHub.cs文件中有一个服务器端方法如下:
public BAL.LiveAuctionBAL AuctionBid(string Lot_Id, string InputAmt, string vendorid, string V_AuctionID, string AddModBy, string OpenBidAmt, string Decrementbid, string LastBidAmount, string auctionEndTimer)
{
BAL.LiveAuctionBAL BAL = new BAL.LiveAuctionBAL();
string result = "";
string msg = "", message = "";
try
{
BAL.Auction_Id = Convert.ToInt32(V_AuctionID);
BAL.Lot_Id = Convert.ToInt32(Lot_Id);
BAL.Vendor_Id = Convert.ToInt32(vendorid);
BAL.Bid_Amount = Convert.ToDouble(InputAmt);
if (auctionEndTimer != "")
{
BAL.AuctionEndTimer = DateTime.Parse(auctionEndTimer.ToString());
}
else
{
BAL.AuctionEndTimer = Convert.ToDateTime("01/01/1900");
}
BAL.AddMod_By = AddModBy;
result = BAL.AddAuctionBid();
if (result != "")
{
msg = result;
this.Clients.All.bidUpdated(result);
}
}
catch
{
}
return BAL;
}
}
现在我试图在客户端调用此方法,如下所示:
var chat = $.connection.auctionhub;
$(function () {
$.connection.hub.start().done(function () {
chat.server.auctionbid(Lot_Id, InputAmt, vendorid, V_AuctionID, AddModBy, OpenBidAmt, Decrementbid, LastBidAmount, auctionEndTimer);
});
});
但该方法未在客户端调用。
答案 0 :(得分:0)
可能对SignalR或jQuery库的引用不正确。尝试使用ResolveClientUrl之类的内容或这些文件的绝对路径。您应该检查浏览器控制台是否有任何错误。