0

我们正在使用 WCF 服务开发应用程序。

我们的客户端应用程序是桌面 WPF 应用程序,我们使用 wsdualhttpbinding 协议与服务器通信。一切都在我们的本地机器上运行良好,但是当我们将它部署到远程服务器时它就不起作用了。应用程序没有抛出任何异常,但我们在服务器的日志中看到请求被接受,但我们没有得到任何响应。

我们认为应用程序工作正常,因为它在本地机器上工作,所以问题出在 .config 文件中。

我们的 web.config:

<?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <configSections>
            <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, 
                     EntityFramework, Version=5.0.0.0, Culture=neutral,
                     PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
        </configSections>
        <appSettings>
            <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
        </appSettings>
        <system.web>
           <compilation debug="true" targetFramework="4.5" />
           <httpRuntime targetFramework="4.5" />
        </system.web>
        <system.serviceModel>
            <bindings>
                <wsDualHttpBinding>
                    <binding name="WSDualHttpBinding_IReceiverController" closeTimeout="00:00:15"
                      openTimeout="00:00:15" receiveTimeout="00:00:15" sendTimeout="00:00:15"
                      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <reliableSession ordered="true" inactivityTimeout="00:00:15" />
                        <security mode="Message">
                            <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>
                </security>
            </binding>
            </wsDualHttpBinding>
        </bindings>
        <services>
            <service name="Namespace.Service1" behaviorConfiguration="svcbh">

                <endpoint name="duplexendpoint" address="" binding="wsDualHttpBinding" contract="Namespace.IService1" bindingConfiguration="WSDualHttpBinding_IReceiverController">

                </endpoint>
                <endpoint name="MetaDataTcpEndpoint" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />       

            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="svcbh">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
   </system.serviceModel>
   <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
            <directoryBrowse enabled="true" />
   </system.webServer>
   <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
   </entityFramework>
</configuration>

这是我们的 app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
    </configSections>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
            <bindings>
                    <wsDualHttpBinding>
                        <binding name="duplexendpoint" clientBaseAddress="http://192.168.1.1">
                                <reliableSession inactivityTimeout="00:00:15" />
                        </binding>
                    </wsDualHttpBinding>
            </bindings>
            <client>
                    <endpoint address="http:////192.168.1.1/Service1.svc" binding="wsDualHttpBinding"
                            bindingConfiguration="duplexendpoint" contract="Namespace.IService1"
                            name="duplexendpoint">
                            <identity>
                                    <servicePrincipalName value="host/SERVIDORWEB" />
                            </identity>
                    </endpoint>
            </client>
        </system.serviceModel>
        <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <dependentAssembly>
                        <assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
                </dependentAssembly>
            </assemblyBinding>
        </runtime>
</configuration>

先感谢您!!!

4

0 回答 0