开发者

Silverlight and URL Rewrite - do they play nice?

开发者 https://www.devze.com 2023-03-06 17:21 出处:网络
I have a Silverlight application deployed behind the firewall using IIS7, and I would like to URL rewrite a public URL to access it. So http://someurl.com would rewrite to http://internalserver/Defaul

I have a Silverlight application deployed behind the firewall using IIS7, and I would like to URL rewrite a public URL to access it. So http://someurl.com would rewrite to http://internalserver/Default.aspx, this is how I setup the rule:

<rewrite>
        <rules>
            <rule name="WebSite_InboundRule" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                <action type="Rewrite" url="http://internalserver/Default.aspx" appendQueryString="false" />
                <conditions logicalGrouping="MatchAny" />
            </rule>
        </rules>
    </rewrite>

At this point (after changing some relative paths to absolute in the ASPX wrapper), the browser gets to the Default.aspx page from http://someurl.com, but then the page is b开发者_运维技巧lank and the Silverlight.js file is the last thing to Fiddler shows that was downloaded. Right-clicking on the page gives me the Silverlight context menu, so my guess is that the Silverlight plug-in loads up fine but for some reason it can't download the XAP file.

Any help on this is greatly appreciated.


The problem is that you're rewriting all inbound URL's (including ones like http://someurl.com/MySilverlightApp.xap) to http://internalserver/Default.aspx. Since that doesn't return a valid XAP file, it makes sense that your Silverlight app won't load. You need to add a rule that redirects requests for XAP files to the appropriate internal location of those XAP files.

0

精彩评论

暂无评论...
验证码 换一张
取 消