【问题标题】:RIA - Silverlight 3 Issue Deploying to exising websiteRIA - Silverlight 3 问题部署到现有网站
【发布时间】:2010-05-12 13:06:39
【问题描述】:

您好,我在将 silverlight 项目部署到现有网站(带有 aspx 页面的普通网站)时遇到问题。

一切正常,除了当silverlight 尝试连接到RIA 服务时,它失败了,因为网站每次都重定向到登录页面。

我在似乎有问题的网站的 web.config 上发现了这个:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="AdWsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://webserver/ADWS/AdWs.asmx" binding="basicHttpBinding"
            bindingConfiguration="AdWsSoap" contract="AdWs.AdWsSoap" name="AdWsSoap" />
    </client>


    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />


</system.serviceModel>

如您所见,该站点正在使用自定义绑定,我猜 RIA 服务会通过它,这就是它重定向到站点登录页面的原因。 我无法修改此自定义绑定(因为它会影响使用此配置运行的许多其他应用程序)。

有没有办法解决这个问题,也许指定 RIA 服务不使用这个自定义绑定??

我尝试自己创建 .SVC 文件并以这种方式覆盖 AddEndpoints:

protected override void AddEndpoints()
    {
        foreach (Uri uri in this.BaseAddresses)
        {
            AddRestWithJsonEndpoint(uri);
        }
    }

但它一直通过自定义绑定。请帮忙。

提前致谢。

【问题讨论】:

    标签: silverlight-3.0 wcf-binding


    【解决方案1】:

    玩了一段时间后,我发现了如何解决我的问题:

    首先,一切都取决于 web.config 及其包含的标签。例如,在我的例子中,我为 silverlight 配置创建了一个单独的配置文件,但最后我只需要将 silverlight 的项目 web.config 与我在主网站上获得的项目合并。

    其次,注意silverlight项目周围使用的连接字符串,在我的例子中,我在项目周围的一些层中有很多连接字符串,所以我忘了复制主web.config上的几个,那就是我出错的原因。

    希望它对某人有所帮助。

    再见。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多