日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
如何保護(hù)WCF服務(wù)元數(shù)據(jù)

WCF服務(wù)元數(shù)據(jù)的保護(hù)方法是一個比較復(fù)雜的步驟。相信對于初學(xué)者來說,很難操作這一方法。在這里我們就為大家介紹一下相關(guān)方法技巧。#t#

創(chuàng)新互聯(lián)公司主要從事成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)保山,10年網(wǎng)站建設(shè)經(jīng)驗(yàn),價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):13518219792

概述

WCF是 Microsoft 為構(gòu)建面向服務(wù)的應(yīng)用程序而提供的統(tǒng)一編程模型(摘自MSDN),在分布式環(huán)境下的安全問題尤為重要,如果你覺得使用了WCF默認(rèn)的安全措施可以讓你高枕無憂,那明天你可就以回家種田了,當(dāng)然,對于學(xué)習(xí)來說,足夠了~,但我們講的是真正的項(xiàng)目應(yīng)用,WCF在各種協(xié)議下的安全提供和保證是不盡相同的。

背景

某天,經(jīng)理老陳對程序員小李說:小李,我們公司外包到一個項(xiàng)目,但是客戶要求采用分布式部署,現(xiàn)在項(xiàng)目快接近尾聲了,由于我們采用的是WCF,所以在部署的時候出現(xiàn)了一點(diǎn)問題,我們的服務(wù)好像誰都能訪問得到啊,這是為什么呢?

WCF服務(wù)元數(shù)據(jù)問題呈現(xiàn)

小李***件事就是去查看了服務(wù)配置文件,真的是不看不知道,一看嚇一跳,原來開發(fā)WCF時,采用的都是默認(rèn)的配置,全是自動生成的代碼,沒有經(jīng)過任何的改動,一想到項(xiàng)目將會以這種姿態(tài)交付,小李著實(shí)捏了一把汗。

 
 
 
  1. < services>
  2. < service name="WcfServiceLibrary2.Service1"
     behaviorConfiguration="WcfService
    Library2.Service1Behavior">
  3. < host>
  4. < baseAddresses>
  5. < add baseAddress = "http://
    localhost:8731/Design_Time_Addresses/
    WcfServiceLibrary2/Service1/" />
  6. < /baseAddresses>
  7. < /host>
  8. < endpoint address ="" binding=
    "wsHttpBinding" contract="WcfService
    Library2.IService1">
  9. < identity>
  10. < dns value="localhost"/>
  11. < /identity>
  12. < /endpoint>
  13. < endpoint address="mex" binding=
    "mexHttpBinding" contract="IMetadataExchange"/>
  14. < /service>
  15. < /services>
  16. < behaviors>
  17. < serviceBehaviors>
  18. < behavior name="WcfServiceLibrary2
    .Service1Behavior">
  19. < serviceMetadata httpGetEnabled="True"/>
  20. < serviceDebug includeException
    DetailInFaults="False" />
  21. < /behavior>
  22. < /serviceBehaviors>
  23. < /behaviors>

WCF服務(wù)元數(shù)據(jù)解決之道

小李***件事就是把配置文件給修改好了,接著解決了困擾老陳許久的問題。

1、刪除元數(shù)據(jù)交換終結(jié)點(diǎn)信息

 
 
 
  1. < endpoint address="mex" 
    binding="mexHttpBinding" 
    contract="IMetadataExchange"/>

2、將http協(xié)議獲取元數(shù)據(jù)重置為:false

 
 
 
  1. < serviceMetadata 
    httpGetEnabled="false"/>

3、一般我們都會在開發(fā)時配置為WCF服務(wù)元數(shù)據(jù)可發(fā)現(xiàn),但是切記,發(fā)布你的服務(wù)前,一定要刪除了,目前,服務(wù)在一定范圍上得到了保護(hù)

4、最終配置如下

 
 
 
  1. < services>
  2. < service
  3. name="WcfServiceLibrary2.Service1"
  4. behaviorConfiguration=
    "WcfServiceLibrary2.Service1Behavior">
  5. < host>
  6. < baseAddresses>
  7. < add baseAddress = "http://
    localhost:8731/Design_Time_Addresses
    /WcfServiceLibrary2/Service1/" />
  8. < /baseAddresses>
  9. < /host>
  10. < endpoint
  11. address =""
  12.  binding="wsHttpBinding"
  13. contract="WcfServiceLibrary2
    .IService1">
  14. < identity>
  15. < dns value="localhost"/>
  16. < /identity>
  17. < /endpoint>
  18. < /service>
  19. < /services>
  20. < behaviors>
  21. < serviceBehaviors>
  22. < behavior name="WcfServiceLibrary2
    .Service1Behavior"> 
  23. < serviceDebug includeException
    DetailInFaults="False" />
  24. < serviceDebug includeException
    DetailInFaults="False"/>
  25. < /behavior>
  26. < /serviceBehaviors>
  27. < /behaviors>

以上就是針對WCF服務(wù)元數(shù)據(jù)的一些操作方法介紹。


分享題目:如何保護(hù)WCF服務(wù)元數(shù)據(jù)
網(wǎng)站URL:http://www.5511xx.com/article/dphijed.html