安全WCF Web服务问题 [英] Secure WCF Web Service Problem

查看:103
本文介绍了安全WCF Web服务问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要放在安全服务器上的Web服务.我已经在网络配置中完成了此操作:

I am developing a web service that needs to sit on a secure server. I''ve done this in the web config:

<behaviors>
    <serviceBehaviors>
        <behavior name="StdBehavior">
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
    </serviceBehaviors>
</behaviors>

<bindings>
    <basicHttpBinding >
        <binding name="secureBinding">
            <security mode="Transport">
                <transport clientCredentialType="Certificate" />
            </security>
        </binding>
    </basicHttpBinding>
</bindings>

<services>
    <service behaviorConfiguration="StdBehavior" name="A.DevelopmentSvc">
        <host>
            <baseAddresses>
                <add baseAddress="https://blah/blah/CrisSvc"/>
            </baseAddresses>
        </host>
        <endpoint address="/" 

                  binding="basicHttpBinding" 

                  bindingConfiguration="secureBinding" 

                  name="devEndpoint" contract="CrisCodeWcf.ICrisSvc" 

                  />
        <endpoint address="mex" 

                  binding="mexHttpsBinding" 

                  name="mexEndpoint" 

                  contract="IMetadataExchange" 

                  />
    </service>
</services>


...但是当我尝试浏览IE中的服务时收到此错误:

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https].


...but I get this error when I try to browse to the service in IE:

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https].

推荐答案

约翰,

我通常使用批处理文件直接运行svcutil.这有一些好处,其中最主要的是您不需要与正在运行的服务进行对话.

svcutil能够根据实现程序集中的服务定义生成所需的代码.

这是我用于此目的的批处理文件的内容:

Hi John,

I usually run svcutil directly, using a batch file. This has a few benefits, chief among them is that you don''t need to talk to a running service.

svcutil is capable of generating the required code based on your service definition from the implementation assembly.

Here is the contents of a batch file I use for this purpose:

SETLOCAL

rem set up path so svcutil can be found
call c:\usr\bin\initvc.cmd


SET ROOTDIR=C:\Src\AjaWorks\AjaWorks.Oracle.Tools

rem this is where the service implmentation assembly is located
SET WCFSERVICEDIR=%ROOTDIR%\Goodtech.Databox.DX.DataService\bin\Debug

SET WCFSERVICECLIENTDIR=%ROOTDIR%\Generated

rem this assembly contains types shared between the client and server
SET COMMONTYPESDLL=%ROOTDIR%\Generated\bin\Debug\Goodtech.Databox.DX.dll


cd %WCFSERVICECLIENTDIR%\wsdl

rem let svcutil generate wsdl
svcutil %ROOTDIR%\Goodtech.Databox.DX.DataService\bin\Debug\Goodtech.Databox.DX.DataService.dll

CD %WCFSERVICECLIENTDIR%\Client

rem let svcutil generate code ( service reference )
svcutil %WCFSERVICECLIENTDIR%\wsdl\*.wsdl %WCFSERVICECLIENTDIR%\wsdl\*.xsd /namespace:*,Goodtech.Databox.DX.Client /targetClientVersion:Version35 /language:C# /ct:System.Collections.Generic.List`1 /out:DataServiceReference.cs /config:GeneratedApp.config /reference:%COMMONTYPESDLL%

ENDLOCAL



一个典型的解决方案通常至少具有:

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