我的服务中的websync工作正常,但经过一些更改后它停止工作,它没有给我任何错误信息,对我来说一切似乎都很好。但肯定有一些问题。我在我的网站上创建了测试页面,但也没有在其中工作。我在这里张贴的代码,请看和建议。
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Publisher publisher = new Publisher(new PublisherArgs() { RequestUrl = "http://www.ffrsdevserver.com/request.ashx" });
Data entity = new Data();
entity.DeptID = 1.ToString();
entity.StationId = "108";
entity.Text = "UpdateAll";
publisher.Publish(new Publication()
{
Channel = "/3db165bf2f25",
DataJson = JSON.Serialize(entity)
});
}
}
[DataContract]
public class Data
{
private string text = string.Empty;
private string deptId = string.Empty;
private string dataType = string.Empty;
private string stationId = string.Empty;
[DataMember(Name = "text")]
public string Text
{
get { return text; }
set { text = value; }
}
[DataMember(Name = "deptId")]
public string DeptID
{
get { return deptId; }
set { deptId = value; }
}
[DataMember(Name = "stationId")]
public string StationId
{
get { return stationId; }
set { stationId = value; }
}
}发布于 2013-06-20 12:51:21
我解决了这个问题。实际上,websync不允许从应用程序外部发布,因此当我从窗口服务调用publish方法时,它不起作用,因此我们需要在web配置文件中添加此标记
<configuration>
<WebSync>
<server httpDirectPublish="true" timeout="25000" reconnectInterval="250" distributeInterval="100" latencyBuffer="7000" heartbeatInterval="30000" />
</WebSync>
</configuration>这将允许网站从外部发布
https://stackoverflow.com/questions/17183509
复制相似问题