คุณใช้การผูกแบบเดียวกันกับทั้งสองอย่างหรือไม่? หากเป็นเช่นนั้น ให้ลองเชื่อมโยง 2 รายการแยกกัน - รายการหนึ่งสำหรับจุดสิ้นสุด mex และอีกรายการหนึ่งสำหรับ wshttp:
ดังนั้นสำหรับการบริการ - บางอย่างเช่น:
<wsHttpBinding><binding name="wsHttpBindingMessageUname">
<security mode="Message">
<message clientCredentialType="UserName" negotiateServiceCredential="true"
establishSecurityContext="false" />
</security></binding></wsHttpBinding>
และสำหรับจุดสิ้นสุด mex (ไม่มีการรักษาความปลอดภัย):
<customBinding><binding name="customMex">
<textMessageEncoding>
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport transferMode="Buffered"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"/></binding></customBinding>
จุดสิ้นสุดของบริการจะมีลักษณะดังนี้:
<endpoint address="" behaviorConfiguration="Server.Services.DefaultEndpointBehavior" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingMessageUname" name="DefaultHttp" contract="Server.Services.IMyService" listenUriMode="Explicit" />
<endpoint address="mex" binding="customBinding" contract="IMetadataExchange" name="" bindingConfiguration="customMex" listenUriMode="Explicit" />
ด้วยการตั้งค่านี้ จะไม่ใช้การรักษาความปลอดภัยสำหรับ mex ดังนั้นคุณไม่ควรได้รับข้อความนั้นเมื่อพยายามอัปเดตการอ้างอิงบริการ ทำเช่นนั้น หรือสร้างการเชื่อมโยงที่ปลอดภัยอื่นที่ใช้ข้อมูลรับรองที่แตกต่างกัน เช่น ใบรับรองไคลเอ็นต์บนเครื่องของคุณ
โพสต์ MSDN ต่อไปนี้มีตัวอย่างสิ่งนี้และข้อมูลเพิ่มเติมสามารถเป็นได้ พบได้ในบล็อกนี้เกี่ยวกับจุดสิ้นสุด mex ที่ปลอดภัย
person
Tanner
schedule
25.06.2009