Silverlight Crossdomain

后端 未结 13 562
面向向阳花
面向向阳花 2021-01-01 10:52

I\'ve seen a lot of links to MSDN and \"works on my machine!\" answers so I\'d like to ask my question with the exact steps to duplicate what I\'m doing. Because we are usin

13条回答
  •  隐瞒了意图╮
    2021-01-01 11:33

    I ran into something like this and adding a ServiceHostFactory fixed my issue. The cross-domain policy file alone did not fix it.

    class MyHostFactory : ServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            MyHost customServiceHost =
              new MyHost(serviceType, new Uri("[Your URL goes here]",UriKind.Absolute));
    
            return customServiceHost;
        }
    }
    
    class MyHost : ServiceHost
    {
        public MyHost(Type serviceType, params Uri[] baseAddresses)   base(serviceType, baseAddresses)
        { }
    
        protected override void ApplyConfiguration()
        {
            base.ApplyConfiguration();
        }
    }
    

    You also have to add Factory="MyHostFactory" in the tag that defines your service

提交回复
热议问题