silverlight 浏览器外的跨域策略

发布于 2024-10-26 10:46:50 字数 1177 浏览 1 评论 0原文

我有一个 silverlight 应用程序,运行良好。

我正在尝试使用“浏览器之外”,但遇到了几个问题。首先,我无法访问我的服务。

即使在简单的返回“testString”服务调用中,我也会收到“超时异常”。我在本地主机上。

所以我认为跨域策略可能存在问题。

我尝试将其放入

    <?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
        <allow-access-from domain="*" />
</cross-domain-policy>

crossdomain.xml 文件中

我也尝试将其放入:

    <?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

但没办法,我仍然收到超时异常,并且在服务器端,我的断点尚未到达。

那么我可能做错了什么?

我到底应该把这些文件放在哪里?

因为我有一台本地IIS服务器,它只有一个“站点”,这个站点有一个“应用程序”,而我的应用程序有一个包含服务的文件夹,所以我应该把它放在哪一层?

非常感谢您

编辑:事实上,我不知道这是否是跨策略问题,或者是否是因为当它处于浏览器外模式时,它无法使用 Windows 身份验证模式(NTLM)

I've a silverlight application, which is running fine.

I'm trying to use "Out of browser" and I encounter several problems. First, I can't get access to my services.

I receive a "Timeout exception", even on a simple return "testString" service call. I'm on localhost.

So I think there is maybe a problem with cross-domain policies.

I tried to put this

    <?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
        <allow-access-from domain="*" />
</cross-domain-policy>

in a crossdomain.xml file

I tried to put this too:

    <?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

But no way, I'm still getting a TimeOut exception, and in server side, my break point hasn't been reached.

So what could I have done wrong?

Where exactly should I put theses files?

Because I've a local IIS server, which has only one "Site", this site has an "application", and my application has a Folder which contains services, so on which level should I put this?

Thank you very much

EDIT: In fact I don't know if this is this cross-policies problem OR if it's that because when it is in Out of Browser mode, it can't use the Windows Authentication mode(NTLM)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

违心° 2024-11-02 10:46:57

我终于找到问题所在了!

这是一个 silverlight 问题:

事实上,我在 App.xaml.cs“ApplicationLoaded”事件中进行 WCF 调用,一旦收到该方法,我就设置了我的 RootVisual。

看起来,当我们处于浏览器外模式时,在设置 RootVisual 之前您无法进行 WCF 调用。

现在我正在设置 RootVisual,当 RootVisual 被“加载”时,我正在执行我的请求。它有效!

I finally found what was the problem!

It was a silverlight issue:

In fact I was making the WCF call in the App.xaml.cs "ApplicationLoaded" event, and once I receive the method, I was setting my RootVisual.

And it seems, that when we are in Out-of-Browser mode, you can't make a WCF call before the RootVisual has been setted.

Now I'm setting the RootVisual, and when the RootVisual is "Loaded", I'm doing my request. and it works!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文