触发跨域 Web 服务时,数据被输入两次
我创建了一个 .net Web 服务,当我尝试调用将数据保存在数据库中的方法时,请求被触发两次。我使用 net profiler 检查是否向服务器发出了两个请求,但只向服务器发出了一个请求。我无法理解为什么数据在数据库中输入两次。我正在使用 jsonp 方法调用跨域站点
我刚刚发现了一些有趣的东西。我有两台服务器。当我在一个主机上托管 Web 服务并使用跨域调用 Web 服务时,数据会输入一次,而在另一个主机上,数据会输入两次。我们还需要处理一些 IIS 设置吗?
I have created a .net web service and when i try to call a method that saves the data in the database, the request is fired twice. I use net profiler to check if two requests are made to the server but only one request is made to server. I fail to understand why data is being entered twice in the database.I am using jsonp method to call the cross domain site
I just found something interesting. I have two servers. When i host the web service on one and call the web service using cross domaining, the data is entered once whereas on the other the data is entered twice. Do we need to take care of some IIS settings too?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,如果没有发出两个请求,那么几乎肯定会从 Web 服务端点触发对 Save() 方法(或任何名称)的两次调用。但某些地方也可能存在重复数据。
以下是需要检查的几件事:
转移?你检查过这个吗
使用像 Charles 这样的工具?
So, if there aren't two requests being made then there are almost certainly two calls to the Save() method (or whatever it is called), being fired from the web service end point. But there maybe dupliacte data somewhere too.
Here are a couple of things to check:
transferred? Have you checked this
using a tool like Charles?
大家好,我刚刚将我的项目转换为 Visual Studio 2010,然后将其安装在服务器上。现在一切都运行得很完美。谢谢
Heyi all, i just converted my project to visual studio 2010 and then installed it on the server. Everything is running perfectly now. Thanks