CrossDomainError在同一个域中 [英] CrossDomainError on same domain

查看:139
本文介绍了CrossDomainError在同一个域中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在学习创建Silverlight使用WCF与后端进行通讯3应用程序。我们将部署到IIS7上Server2008中或Vista。客户端二进制文件和Web服务的二进制文件都位于同一个IIS web目录。当我打的服务头版上(http://localhost/MyService.svc)返回就好了。当我打的应用程序(HTTP://localhost/index.html)让我的Silverlight应用程序。静态材料使就好了,不过这两个领域我试着填写申报表CrossDomainError。据我了解发生这种情况时,你打从托管在其他一些领域的网页服务。我不相信,我这样做,除非在不知不觉中。

I'm learning to build Silverlight 3 apps using WCF to communicate with the back end. We are going to deploy to IIS7 on Server2008 or Vista. The client binaries as well as the web service binaries are all located in the same IIS web directory. When I hit the service front page (http://localhost/MyService.svc) it returns just fine. When I hit the app (http://localhost/index.html) i get my Silverlight app. The static material renders just fine, however the two fields im trying to fill return with CrossDomainError. From what I understand this occurs when you hit a service from a page hosted on some other domain. I don't believe I'm doing that, unless unwittingly.

异常消息是:

[CrossDomainError] 参数:HTTP://本地主机:2721 / Service1.svc 调试资源字符串不可用。通常情况下,密钥和参数提供足够的信息来诊断问题。参见[一些可怕的URL这我不会在这里重现,因为它是无用反正]

[CrossDomainError] Arguments:http://localhost:2721/Service1.svc Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See [some horrendous url which i wont reproduce here since it was useless anyway]

我打开端口2721入站和出站,没有效果。

I opened port 2721 both inbound and outbound with no effect.

有什么想法?

推荐答案

有关两个文件被认为具有相同的起源一切都必须是完全一样的:协议(HTTP / HTTPS),域和端口

For two documents to be considered to have the same origin everything must be exactly the same: protocol (http/https), domain and port.

所以,如果你打开​​的http://本地主机并设法使请求的的http://本地主机:2721 ,你会得到错误

So, if you open up http://localhost and try to make a request to http://localhost:2721, you'll get that error.

这篇关于CrossDomainError在同一个域中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆