English 中文(简体)
WCF 自定义Binding - 无法通过自定义授权政策获得元数据
原标题:WCF CustomBinding - Cannot obtain Metadata with custom authorization policy

在解决了我之前的问题之后,我想将网络TcpBinding转换成一个自定义Binding,而我管理得非常顺畅。 然而,WcfTesterClient(和普通客户端)在试图提取元数据时,当我设置了自定义授权政策(它没有效果良好 ) 。

我的配置 :

<serviceAuthorization principalPermissionMode="Custom">
        <authorizationPolicies>
          <add policyType="Sample.Tools.CustomAuthorizationPolicy, Sample" />
        </authorizationPolicies>

我在MSDN上读过(这里:),这可能是因为还需要一个自定义授权管理器。我尝试了这个方法,并添加了自定义管理器以及(CrycAceptCre总能恢复真实性),但它没有奏效。

在配置中添加以下内容:

    <serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="Sample.Tools.CustomAuthorizationManager, Sample">
        <authorizationPolicies>
          <add policyType="Sample.Tools.CustomAuthorizationPolicy, Sample" />
        </authorizationPolicies>

其余的配置 :

有约束力:

<customBinding>
      <binding name="SampleBinding" receiveTimeout="00:05:00">
        <transactionFlow/>
        <security authenticationMode="SecureConversation" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
            <secureConversationBootstrap authenticationMode="UserNameForSslNegotiated" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
                <localClientSettings maxClockSkew="23:59:59" />
                <localServiceSettings maxClockSkew="23:59:59" />
           </secureConversationBootstrap>                   
            <localClientSettings maxClockSkew="23:59:59" />
            <localServiceSettings maxClockSkew="23:59:59" />
        </security>
        <binaryMessageEncoding/>
        <tcpTransport transferMode="Buffered" portSharingEnabled="true" maxReceivedMessageSize="65536" hostNameComparisonMode="StrongWildcard"/>
      </binding>
    </customBinding>

行为 :

<behavior name="SampleBehavior">
      <serviceMetadata httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true" httpsHelpPageEnabled="true" />
        <serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="Sample.Tools.CustomAuthorizationManager, Sample">
        <authorizationPolicies>
          <add policyType="Sample.Tools.CustomAuthorizationPolicy, Sample" />
        </authorizationPolicies>
      </serviceAuthorization>
      <serviceCredentials>
        <serviceCertificate findValue="MySample" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Sample.Tools.CustomUserNameValidator, Sample" />
      </serviceCredentials>
      <serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="2147483647" maxConcurrentInstances="2147483647" />
    </behavior>

服务:

<services>
    <service behaviorConfiguration="SampleBehavior"
    name="Sample.SampleService">
    <endpoint address="" 
              binding="customBinding" 
              bindingConfiguration="SampleBinding"
              name="MyServiceEndpoint" 
              contract="Sample.ISampleService">
        <identity>
            <dns value="localhost" />
        </identity>
    </endpoint>

    <endpoint address="mex" 
              binding="mexTcpBinding" 
              bindingConfiguration=""
              name="MyServiceMexTcpBidingEndpoint" 
              contract="IMetadataExchange" />
        <host>
            <baseAddresses>
                <add baseAddress="net.tcp://localhost:809/SampleService.svc" />
            </baseAddresses>
        </host>
    </service>
</services>    

我几乎被困在这里,在这个问题上几乎找不到什么线索。

最佳回答

我在这里看到这个漂亮的文章:http://social.msdn.microsoft.com/forums/en-US/wcf/thread/86ed7974-97d4-4cc8-a965-542a3063aced

这固定了我的问题, 现在我需要研究 执行一个适当的服务授权管理者:)

问题回答

暂无回答




相关问题
Session Management with Windows Authentication

In an ASP.NET web app, using Integrated Windows Authentication, is the session tied to the windows identity? In other words, if I login (using IWA) to the app, and the app stores some "stuff" in my ...

Using Elmah with Cassini

Does anyone know if I can use Elmah with Visual Studio build-in web server(aka Cassini)? I get it working easily on IIS, but using same configuration, it doesn t work with Cassini. When I requested ...

Setting hostname in IIS, include www?

I want to set the hostname for a website I m adding in IIS 7, however do I include the www in the hostname or not? because I want both www.mysite.com and mysite.com both to point to mysite on the ...

inetpub versus any other folder

I ve run websites out of inetpub, as well as from folders just residing on the C: drive. I wonder, are there any definitive advantages to running websites out of inetputwwwroot?

IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

热门标签