13 messaggi dal 01 agosto 2006
Ciao,
ho creato un'applicazione SharePoint che espone un semplice servizio WCF:
[BasicHttpBindingServiceMetadataExchangeEndpoint]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
    public class ServiceWF : IServiceWF
    {
       public string PingService()
       {
           return "OK";
       }
    }

    [ServiceContract(Namespace = "OW.WIO.ServiceWF.Operations")]
    public interface IServiceWF
    {
       [OperationContract]
        string PingService();
    }

Quando viene richiamato tramite un'applicazione console che gira sulla stessa macchina si ottiene il seguente errore:
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. 
The authentication header received from the server was 'NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory`1 factory)
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at WcfTestClient.ActioDev.IServiceWF.PingService()
   at WcfTestClient.ActioDev.ServiceWFClient.PingService()
   at WcfTestClient.Program.ActioDev()

La macchina e' inserita in un dominio e il client funziona correttamente se imposto le credenziali:
   var wCred = client.ClientCredentials.Windows.ClientCredential;
   wCred.Domain = domain;
   wCred.UserName = userName;
   wCred.Password = password;

Client app.config:
<system.serviceModel>
   <bindings>
      <basicHttpBinding>
         <binding name="Std" />
      </basicHttpBinding>
   </bindings>
   <client>
      <endpoint address="http://localhost/_vti_bin/ServiceWF/servicewf.svc"
binding="basicHttpBinding" bindingConfiguration="Std" contract="ActioDev.IServiceWF" name="ActioDev" />
   </client>
</system.serviceModel>


Mi piacerebbe rimuovere l'autenticazione in modo che il servizio sia accessibile a chiunque.
Ringrazio in anticipo chiunque mi puo' dare delle indicazioni in merito.

stefano22

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.