简体   繁体   English

是否有可能在ASPX中运行的WCF客户端通过net.pipe在同一台计算机上的另一个站点中通过SVC调用SVC?

[英]Is it possible to have a WCF client running in an ASPX call an SVC via net.pipe in another site on the same machine?

I have two web sites-- one with an aspx file, one with a wcf service with two end points, one http and one named pipes. 我有两个网站-一个带有aspx文件的网站,一个带有wcf服务且带有两个端点,一个http和一个命名管道的网站。 They both run on the same machine, so they seemed like a candidate for using the net.pipe binding. 它们都在同一台机器上运行,因此它们似乎是使用net.pipe绑定的候选对象。

The aspx file creates a service client and attempts to call the net.pipe. aspx文件创建一个服务客户端,并尝试调用net.pipe。 And I get this: 我得到这个:

"Server Error in '/dev' Application.The message could not be dispatched because the service at the endpoint address 'net.pipe://localhost/netNamedPipeBinding' is unavailable for the protocol of the address." “'/ dev'应用程序中的服务器错误。由于在端点地址'net.pipe:// localhost / netNamedPipeBinding'上的服务不适用于该地址的协议,因此无法调度该消息。”

Googling suggest this could be a security problem (no permissions errors are the same as no listener errors), but I've already granted NTFS rights to the [NETWORK] user group to the websites files with the services and no change. 谷歌搜索表明这可能是一个安全问题(没有权限错误与没有侦听器错误相同),但是我已经向[NETWORK]用户组授予了具有服务的网站文件的NTFS权限,并且没有任何更改。

The site with the aspx is using Forms authentication (ie not windows auth) and the service website is anonymous auth. 具有aspx的网站正在使用表单身份验证(即,不是Windows身份验证),服务网站是匿名身份验证。 The web.config's have the net.pipe security set to ="None" web.config的net.pipe安全性设置为=“ None”

Locally, this works fine-- although I have to run the named pipes host in a console app since the Visual Studio Dev Server can't do named pipes. 在本地,这可以正常工作-尽管我必须在控制台应用程序中运行命名管道主机,因为Visual Studio Dev Server无法执行命名管道。 Also, the Http endpoint works fine on IIS. 另外,Http终结点在IIS上也可以正常工作。

It's running .NET 4.0, IIS 7.5, Win2008. 它正在运行.NET 4.0,IIS 7.5,Win2008。

IIS Config As far as I can tell, IIS Config据我所知,

  • net.pipe has been enabled for the service website, with config info of * 服务网站已启用net.pipe,配置信息为*
  • WAS is installed and enabled, (via windows features) WAS已安装并启用(通过Windows功能)
  • the net.pipe listener Windows service is enabled. net.pipe侦听器Windows服务已启用。
  • Each website is anonymous access (auth is done by a 3rd party single sign on sever) 每个网站都是匿名访问(通过服务器上的第三者单点登录进行身份验证)
  • Each website has it's own app pool (probably not relevant) 每个网站都有自己的应用程序池(可能不相关)
  • The service site is in web garden mode (probably not relevant) 服务站点处于网络花园模式(可能不相关)

Service Config (Running on IIS on same machine, different VDIR) 服务配置 (在同一台计算机上的IIS上运行,不同的VDIR)

<system.serviceModel>
    <bindings>
        <netNamedPipeBinding>
            <binding name="netNamedPipeBindingConfig" 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>
    <services>
        <service name="MyService">
            <host>
                <baseAddresses>
                    <add baseAddress="net.pipe://localhost/" />
                </baseAddresses>
            </host>
            <endpoint
                         address="netNamedPipeBinding"
                         bindingConfiguration="netNamedPipeBindingConfig"
                         binding="netNamedPipeBinding"
                         contract="IMyService" >
            </endpoint>
        </service>
    </services>
    <serviceHostingEnvironment  multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Client Config (ASP.NET website, same machine, different VDIR from service) 客户端配置 (ASP.NET网站,同一台计算机,与服务不同的VDIR)

    <system.serviceModel>
    <bindings>
        <netNamedPipeBinding>
            <binding name="NetNamedPipeBinding_IMyService" 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/netNamedPipeBinding"
                binding="netNamedPipeBinding"
                bindingConfiguration="NetNamedPipeBinding_IMyService"
                contract="MyService.IMyService"
                name="NetNamedPipeBinding_IMyService">
        </endpoint>
    </client>
</system.serviceModel>

(Service & contract names changed to protect the innocent) (更改服务和合同名称以保护无辜者)

The C# isn't anything special, just the Add-Service-Reference generated proxy. C#没什么特别的,只是Add-Service-Reference生成的代理。 (And all that code works fine with the wsHttp binding (并且所有这些代码都可以通过wsHttp绑定正常工作

You cannot set the base address of a named pipe when it is hosted in IIS in this fashion. 当命名管道以这种方式承载在IIS中时,您无法设置其名称。 As a result the service can not be found by the client. 结果,客户端无法找到该服务。 Look at the answer here for more details: controlling-the-name-of-a-named-pipe-when-hosting-wcf-net-pipe-binding-in-iis 在这里查看答案以了解更多详细信息: 在iis中托管wcf-net-pipe-binding时控制命名管道的名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM