使用WCF服务托管Silverlight应用程序的问题 [英] Issue with Hosting Silverlight Application with WCF Service

查看:70
本文介绍了使用WCF服务托管Silverlight应用程序的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


部署之后,我可以看到ASP.Net页面上的Silverlight控件正在加载.但是,似乎找不到我的.Web应用程序中的WCF服务.这是我的ServiceReference. ClientConfig文件数据…

Hi,
After deployment, I can see the Silverlight control on ASP.Net page being loaded. But, my WCF service which is in my .Web application is not been found it seems. Here is my ServiceReference. ClientConfig file data…

/**************************************

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IServiceIncident" maxBufferSize="2147483647"

            maxReceivedMessageSize="2147483647" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="../ServiceIncident.svc"

          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceIncident"

          contract="ServiceReference1.IServiceIncident" name="BasicHttpBinding_IServiceIncident" />
    </client>
  </system.serviceModel>
</configuration>

/**************************************



我以这种方式调用Service客户端对象:



And I am calling the Service client object in this way:

ServiceReference1.ServiceIncidentClient Prp_WCFService
        {
            get
            {
                if (lObjWCFService == null)
                {
                    Uri lUri = new Uri(Application.Current.Host.Source, "../ServiceIncident.svc");
                    lObjWCFService = new ServiceReference1.ServiceIncidentClient("BasicHttpBinding_IServiceIncident", lUri.AbsoluteUri);

                }
                return lObjWCFService;
            }
        }




我的web.config如下...




And my web.config is as follows…

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

/**************************************



另外,我在IIS中配置了所有必需的MIME.
我需要在这里做任何事情吗?请帮助



Also, I have all the required MIME configured in my IIS.
Do I need to do anything here. Please help

推荐答案

您好,

我从未见过像"../blahblah.svc"这样的端点被指定
尝试指定托管您的svc的URL,例如:
http://localhost:8080/blahblah.svc

其中8080​​可以用端点端口号替换,而blahblah.svc可以用svc文件替换.
Hi,

I have never seen an endpoint being specified like "../blahblah.svc"
Try specifying the url on which your svc is being hosted, like:
http://localhost:8080/blahblah.svc

where 8080 can be replaced by your endpoint portnumber and blahblah.svc by your svc file.


Solved...

I have copied XMLs quoted below in wwwroot folder ...

clientAccessPolicy.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 include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>


and crossDomain.xml

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


这篇关于使用WCF服务托管Silverlight应用程序的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆