के साथ डब्ल्यूसीएफ सेवा एंडपॉइंट सुरक्षित करना मैं डब्ल्यूसीएफ सेवा के कुछ अंतराल को सुरक्षित करना चाहता हूं, मुझे नहीं पता कि आप कुछ एंडपॉइंट सुरक्षित कर सकते हैं और कुछ नहीं। नीचे मेरे पास छीन ली गई डब्ल्यूसीएफ सेवा (स्वयं होस्टेड) है। वही डब्ल्यूसीएफ सीए पॉलिसी फाइल भी पेश करता है। अगर मैं इस डब्ल्यूसीएफ सेवा को सुरक्षित करता हूं या सीए पॉलिसी भाग के कुछ अंतराल को मुझे उपयोगकर्ता नाम पासवर्ड नहीं पूछना चाहिए। पॉलिसी फाइल हर समय सुलभ होनी चाहिए। क्या यह भी संभव है?कस्टम प्रमाणीकरण
मुझे बहुत डब्लूसीएफ कस्टम ब्लॉग/पोस्टिंग मिलीं। सुरक्षा करने के कई तरीके हैं। मैं चाहता हूं कि मैं उपयोगकर्ता नाम/पासवर्ड के साथ कुछ अंतराल सुरक्षित कर सकूं लेकिन क्रेडेंशियल्स को फिडलर जैसे टूल के साथ दिखाई नहीं देनी चाहिए। डेटा हालांकि यह इस मामले में दिखाई दे सकता है।
मैंने पहले से ही एक कस्टम वैलिडेटर लागू किया है लेकिन app.config फ़ाइल चीजों को परिभाषित करने के लिए भी आयातक है। और मैं उस पर बहुत अच्छा नहीं हूँ।
namespace WindowsFormsApplication11
{
public partial class Form1 : Form
{
public ServiceHost _host = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Create a ServiceHost for the CalculatorService type and
// provide the base address.
_host = new ServiceHost(typeof(WmsStatService));
_host.AddServiceEndpoint(typeof(IPolicyProvider), new WebHttpBinding(), "").Behaviors.Add(new WebHttpBehavior());
_host.Open();
}
}
// Define a service contract.
[ServiceContract(Namespace = "http://WindowsFormsApplication11")]
public interface IWmsStat
{
[OperationContract]
string getConnectedViewers(string channelName);
[OperationContract]
string sayHello(string name);
}
[ServiceContract]
public interface IPolicyProvider
{
[OperationContract, WebGet(UriTemplate = "/ClientAccessPolicy.xml")]
Stream ProvidePolicy();
}
//[DataContract]
public class Ads
{
// [DataMember]
public string AdFileName { get; set; }
//[DataMember]
public string AdDestenationUrl { get; set; }
public string ConnectedUserIP { get; set; }
}
//
public class CustomValidator : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if(null == userName || null == password)
{
throw new ArgumentNullException();
}
if(userName == "Oguz" && password == "2009")
{
return;
}
FaultCode fc = new FaultCode("ValidationFailed");
FaultReason fr = new FaultReason("Good reason");
throw new FaultException(fr,fc);
}
}
//
public class WmsStatService : IWmsStat, IPolicyProvider
{
public string sayHello(string name)
{
return "hello there " + name + " nice to meet you!";
}
public Stream ProvidePolicy()
{
WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml";
return new MemoryStream(File.ReadAllBytes("ClientAccessPolicy.xml"), false);
}
public string getConnectedViewers(string channelname)
{
// do stuff
return null;
}
}
}
app.config। यह कॉन्फ़िगरेशन फ़ाइल काम नहीं करती है। मैं एक एंडपॉइंट के लिए कस्टम प्रमाणीकरण रखना चाहता था। मेरे पास कोई सुराग नहीं है।
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="WindowsFormsApplication11.WmsStatService" behaviorConfiguration="mex">
<host>
<baseAddresses>
<add baseAddress="http://192.168.0.199:87" />
</baseAddresses>
</host>
<endpoint address="http://192.168.0.199:87/Test" binding="basicHttpBinding" bindingConfiguration="" contract="WindowsFormsApplication11.IWmsStat" behaviorConfiguration="MyServiceBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<!--<bindings>
<wsHttpBinding>
<binding name="wshttp">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>-->
<behaviors>
<serviceBehaviors>
<behavior name="mex">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
</behavior>
<behavior name="MyServiceBehavior">
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WindowsFormsApplication11.CustomValidator, CustomValidator" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
अरे मैं इस अब :( फ़ाइल या विधानसभा 'CustomValidator' या अपनी निर्भरता से एक लोड नहीं कर सका हो रही है प्रणाली निर्दिष्ट फ़ाइल नहीं मिल सकता है – Shift
कि त्रुटि इस config यहाँ से आता है userNamePasswordValidationMode = "कस्टम" customUserNamePasswordValidatorType = "WindowsFormsApplication11.CustomValidator, CustomValidator" /> serviceCredentials> "CustomValidator" विधानसभा उपलब्ध मैं बदल कि जब आप अपने सेवा ?? –
चलने वाले WindowsFormsAppiication11 करने के लिए। यह एक आत्म WCF की मेजबानी की है विंडोज़ फॉर्म पर सेवा। मैंने इसे बदलने के बाद कहा कि त्रुटि खत्म हो गई है लेकिन एक और मुद्दा :( 'http://192.168.0.199:87/Test' पर चैनलडिस्परचर 'IWmsStat' 'के साथ' IWmsStat "'अपने आईसीएचनल लिस्टनर – Shift