开发者

Where to place the clientaccesspolicy? silverlight + WCF on local

I have a silverlight application which has a WCF in it. when I try to run the silverlight and call the WCF in fail in communication exception. I've understand that I have to add a client access policy file but I don't know where. when the silverlight is running it runs this path:

SilverlightApplication1\SilverlightApplication1\Bin\Release\SilverlightApplication1TestPage.html

and this is from the web.config of WCF:

<services>
        <service behaviorConfiguration="FileUpAndDownload.Web.MapServiceBehavior" name="FileUpAndDownload.Web.MapService">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MapBinding" contract="FileUpAndDownload.Web.IMapService">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>

where do I have to place the clientaccesspolicy file?

Note: both silverlight a开发者_C百科nd WCF are running on local.

thanks!


Place clientaccesspolicy.xml in root of your app. For Cassini it should be ..\bin\release\clientaccesspolicy.xml, for IIS place it in ..\inetpub\wwwroot\yourapp\clientaccesspolicy.xml. More on http://msdn.microsoft.com/en-us/library/cc197955%28v=vs.95%29.aspx


I'm more then sure that you do not need a ClientAccessPolicy if you are running everying on a local machine. But if you do - put it in your root folder. The problem is likely to be in a mismatch between your web and client configs, or just things in your web.config that you do not need that might be causing communication fails. Try to get rid of stff like Mex binding that you do not need and see if you can get it working with minimal configuration.

I saw another one of your question about the same from a week ago that had your client.config file in it. I can say that I was not able to get my own application to work untill i fixed mismatching contract names in the endpoint configurations. Try this:

<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MapBinding" contract="FileUpAndDownload.Web.MapService">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>

Notice the I is gone in your contract, hope it helps =)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜