2

当我从本地机器访问服务时,一切正常。但是,当我在子域站点上托管 silverlight 应用程序时,我没有得到任何响应。Silverlight 应用程序是在同一个子域上还是在不同的子域上都没有关系。什么都没发生。

这是我的服务的 web.config 文件:

    <?xml version="1.0"?>
    <configuration>

     <system.web>
      <compilation debug="true" targetFramework="4.0" />
     </system.web>
     <system.serviceModel>

    <services>
      <service behaviorConfiguration="Metadata" name="IVA_SL5_WCFservice.Service1">
        <endpoint address="http://subdomain.website.com/INA-inv_s/Service1.svc" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_Service1" contract="IVA_SL5_WCFservice.Service1" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <timeouts closeTimeout="00:10:00" openTimeout="00:10:00" />
        </host>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_Service1" closeTimeout="00:25:00"           openTimeout="00:01:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647"
          maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Metadata">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
   <!-- <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> -->
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <!--
  <system.diagnostics>
    <sources>

这是 silverlight 应用程序中的 ClientConfig 文件:

<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_Service1" closeTimeout="00:25:00"
                openTimeout="00:25:00" sendTimeout="00:25:00" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://subdomain.website.com/IVA-inv_s/Service1.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service1"
            contract="IVA_Service.Service1" name="BasicHttpBinding_Service1" />
    </client>
</system.serviceModel>
</configuration>

我像这样在silverlight应用程序上调用服务......

Service1Client client;
client = new IVA_Service.Service1Client("BasicHttpBinding_Service1");//"BasicHttpBinding_Service1");

我已经搞砸了好几天了......请帮忙!

4

1 回答 1

0

声明服务时尝试添加绝对 URI

new IVA_Service.Service1Client("BasicHttpBinding_Service1",
                            (new Uri(Application.Current.Host.Source,"../Service1.svc")).AbsoluteUri);
于 2012-10-26T16:51:28.707 回答