是什么原因导致svcutil在代理远程服务器时建议netNamedPipeBinding?

时间:2012-06-19 15:31:02

标签: c# wcf wsdl svcutil.exe remote-server

我正在尝试在远程服务器上使用WCF服务。我可以浏览到该服务(其格式为http://IntranetServerName:40000/VirtualDirectoryName/ServiceName.svc的位置),以便我可以浏览到远程位置。

然后我(按照页面的指示)运行     命令行中的svcutil.exe http://IntranetServerName:40000/VirtualDirectoryName/ServiceName.svc?wsdl

生成了一个客户端,但配置文件似乎已将端点从远程位置转换为localhost,并假设它是一个命名管道(它不是)。

我认为网络中的某个地方存在问题(防火墙等),但我与之交谈的网络用户表示他们可以看到流量并且这是一个应用程序问题。

首先,我想了解在代理远程服务器时svcutil建议netNamedPipeBinding的原因是什么?如果我理解它可能会为我后来遇到的问题提供线索。

我无法访问远程服务器的文件系统。我在Windows 7 64位上使用VS2010。这是配置文件:

<configuration>
    <system.serviceModel>
        <bindings>
            <netNamedPipeBinding>
                <binding name="ServiceNameNamedPipeEndPoint" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
                    maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport protectionLevel="EncryptAndSign" />
                    </security>
                </binding>
            </netNamedPipeBinding>
        </bindings>
        <client>
            <endpoint address="net.pipe://localhost/VirtualDirectoryName/ServiceName.svc"
                binding="netNamedPipeBinding" bindingConfiguration="ServiceNameNamedPipeEndPoint"
                contract="ServiceNameContract" name="ServiceNameNamedPipeEndPoint" />
        </client>
    </system.serviceModel>
</configuration>

感谢。

更新

我一直在关注WSDL,我发现了这个:

<wsdl:service name="ServiceName">
 <wsdl:port name="ServiceNameNamedPipeEndPoint" binding="i0:ServiceNameNamedPipeEndPoint">
  <soap12:address location="net.pipe://localhost/VirtualDirectoryName/ServiceName.svc"/>
   <wsa10:EndpointReference>
    <wsa10:Address>
net.pipe://localhost/VirtualDirectoryName/ServiceName.svc
   </wsa10:Address>
  </wsa10:EndpointReference>
 </wsdl:port>
</wsdl:service>

在我看来,指定Named Pipes是要使用的绑定。这听起来有道理吗?如果是这样,有人可以建议将哪些操作或设置添加到WSDL中?

更新(2)

这是服务的配置:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <appSettings>
    <add key="Logging" value="True" />
    <add key="LogPath" value="c:\Temp\" />
  </appSettings>
  <connectionStrings>
    <add name="MyAppConnectionString" connectionString="Data Source=ReportingServerName\MyApp_UAT;Initial Catalog=MyApp;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.serviceModel>
    <extensions>
      <behaviorExtensions>
        <add name="UnityBehaviorExtension" type="MyDomain.MyApp.Business.Services.Implementations.UnityEndPointBehaviour, MyDomain.MyApp.Business.Services.Libs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cf929a8c65660387" />
      </behaviorExtensions>
    </extensions>
    <bindings>
      <netNamedPipeBinding>
        <binding name="NamedPipeBinding" openTimeout="00:05:00" sendTimeout="00:05:00" receiveTimeout="02:00:00">
          <security mode="None">
            <transport protectionLevel="None" />
          </security>
        </binding>
      </netNamedPipeBinding>
      <netTcpBinding>
        <binding name="NetTcpBinding_MyReportsService" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="6553600" maxConnections="10" maxReceivedMessageSize="6553600">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IReportGeneratorService" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="">
              <extendedProtectionPolicy policyEnforcement="Never" />
            </transport>
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="BasicHttpBinding_PackageTriggerServiceContract" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="">
              <extendedProtectionPolicy policyEnforcement="Never" />
            </transport>
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IReportGeneratorService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="">
              <extendedProtectionPolicy policyEnforcement="Never" />
            </transport>
            <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
        <binding name="MetadataExchangeHttpBinding_IReportGeneratorService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="">
              <extendedProtectionPolicy policyEnforcement="Never" />
            </transport>
            <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://IntranetServerName:41000/MyDomain.MyApp.Reports.Services.WebHost/MyDomain.MyApp.Reports.Services.Hosts.ReportGeneratorServiceHost.svc/mex" binding="wsHttpBinding" bindingConfiguration="MetadataExchangeHttpBinding_IReportGeneratorService" contract="SvcReference.IReportGeneratorService" name="MetadataExchangeHttpBinding_IReportGeneratorService" />
      <endpoint address="http://IntranetServerName:41000/MyDomain.MyApp.Reports.Services.WebHost/MyDomain.MyApp.Reports.Services.Hosts.ReportGeneratorServiceHost.svc/basic" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IReportGeneratorService" contract="SvcReference.IReportGeneratorService" name="BasicHttpBinding_IReportGeneratorService" />
      <endpoint address="http://ReportingServerName:42500/MyDomain.MyApp.Integration.Services.PackageTriggerService" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_PackageTriggerServiceContract" contract="PackageTriggerService.PackageTriggerServiceContract" name="BasicHttpBinding_PackageTriggerServiceContract" />
    </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="UnityBehaviorExtension">
          <UnityBehaviorExtension />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.REPS_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.SRefS_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.MyReportsInterfaceService_behaviour">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.DFS_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.ServiceName_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementation.FCS_Behaviour">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementation.FCS2_Behaviour">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.BIS_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.CS_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.W2CS_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
        </behavior>
        <behavior name="MyDomain.MyApp.Business.Services.Implementations.TrS_Behavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.REPS_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.REPS">
        <clear />
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="REPSMexEndPoint" contract="IMetadataExchange" listenUriMode="Explicit" />
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/REPS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="REPSNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IREPSContract" listenUriMode="Explicit" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.W2CS_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.W2CS">
        <clear />
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="W2CSMexEndPoint" contract="IMetadataExchange" listenUriMode="Explicit" />
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/W2CS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="W2CSNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IW2CSContract" listenUriMode="Explicit" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.SRefS_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.SRefS">
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="SRefSMexEndPoint" contract="IMetadataExchange" />
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/SRefS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="SRefSNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.ISRefSContract" listenUriMode="Explicit" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.MyReportsInterfaceService_behaviour" name="MyDomain.MyApp.Business.Services.Implementations.MyReportsService">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_MyReportsService" name="MyReportsServiceNetTcpEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IMyReportsServiceContract" />
        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MyReportsServiceMexTcpBindingEndpoint" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:50000/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.DFS_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.DFS">
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="DFSMexEndPoint" contract="IMetadataExchange" />
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/DFS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="DFSNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IDFSContract" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.ServiceName_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.ServiceName">
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="ServiceNameMexEndPoint" contract="IMetadataExchange" />
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/ServiceName.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="ServiceNameNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IServiceNameContract" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementation.FCS_Behaviour" name="MyDomain.MyApp.Business.Services.Implementations.FCS">
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/FCS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="FCSNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IFCSContract" />
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="FixedContractMexEndPoint" contract="IMetadataExchange" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementation.FCS2_Behaviour" name="MyDomain.MyApp.Business.Services.Implementations.FCS2">
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/FCS2.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="FCS2NamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IFCS2Contract" />
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="FlexContractMexEndPoint" contract="IMetadataExchange" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.BIS_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.BIS">
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/BIS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="BISNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IBISContract" />
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="BISMexEndPoint" contract="IMetadataExchange" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.CS_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.CS">
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/CS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="CSNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.ICSContract" />
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="CSMexEndPoint" contract="IMetadataExchange" />
      </service>
      <service behaviorConfiguration="MyDomain.MyApp.Business.Services.Implementations.TrS_Behavior" name="MyDomain.MyApp.Business.Services.Implementations.TrS">
        <endpoint address="net.pipe://localhost/MyDomain.MyApp.Business.Services.WebHost/TrS.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="TrSNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.ContractA" />
        <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="TrSMexEndPoint" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5" />
        <providerOption name="OptionInfer" value="true" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
    </compilers>
  </system.codedom>
  <system.web>
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </controls>
    </pages>
    <httpHandlers>
      <remove verb="*" path="*.asmx" />
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="ScriptModule" />
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated" />
      <remove name="ScriptHandlerFactory" />
      <remove name="ScriptHandlerFactoryAppServices" />
      <remove name="ScriptResource" />
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing, Verbose" propagateActivity="true">
        <listeners>
          <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>

我现在也可以访问托管该服务的服务器。这是IIS 6.1。

在网站的高级设置中,启用的协议设置为“http,net.pipe,net.tcp,net.msmq”。我没想到在该列表中看到“http”所以我仍然对为什么svcutil只生成命名管道绑定感到困惑。我想要的是一个可以远程使用的绑定。你能看到我应该改变什么以允许这个吗?

感谢。

2 个答案:

答案 0 :(得分:2)

我现在想出来了。

在服务配置的<services>元素中,我添加了一个新的endpoint元素:

 <service>
    <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration="" name="ServiceNameMexEndPoint" contract="IMetadataExchange" />
    <endpoint address="net.pipe://localhost/VirtualDirectoryName/ServiceName.svc" behaviorConfiguration="UnityBehaviorExtension" binding="netNamedPipeBinding" bindingConfiguration="NamedPipeBinding" name="ServiceNameNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IServiceNameContract" />
    <!-- 20/06/2012 added this to let svcutil benerate a non-named pipe binding START-->
        <endpoint address="http://sluat01lonuk.gazpromuk.intra:40000/VirtualDirectoryName/ServiceName.svc" behaviorConfiguration="UnityBehaviorExtension" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceName" name="ServiceNameNamedPipeEndPoint" contract="MyDomain.MyApp.Business.Services.Contracts.IServiceNameContract" />
        <!-- 20/06/2012 added this to let svcutil benerate a non-named pipe binding END-->
  </service>

svcutil仅生成命名管道连接的原因是没有公开替代端点。

我将此更改发送到服务后,WSDL已更新为保留新端点。然后重新运行svcutil导致将basicHttpBinding绑定添加到output.config。

完全明确地回答我的问题: 代理远程服务器时svcutil建议netNamedPipeBinding的原因是服务配置中的<services>元素仅包含net.pipe endpoint而不是http(或者,我猜net.tcp)端点

希望这有助于某人。

感谢。

答案 1 :(得分:1)

WCF服务有三件事就是ABC

A - 地址 - 如wsdl:service部分所示,并链接wsdl:绑定到具体的服务端点地址

B - 绑定 - 如wsdl:binding部分所表示,并将wsdl:portType合约描述绑定到具体传输,信封格式和相关策略

C - Contract - 在wsdl:portType,wsdl:message和wsdl:type部分中表示,并描述类型,消息,消息交换模式和操作

您已发布的WSDL中的服务部分明确指出,该服务已暴露给netNamedPipeBinding。

但是我不明白,为什么它可以通过HTTP协议访问(http:// IntranetServerName:40000 / VirtualDirectoryName / ServiceName.svc?wsdl)

您是否有机会查看服务的配置文件?