locked
WCF Service and SharePoint site - SSL RRS feed

  • Question

  • A SharePoint site is hosted in a server.

    A method from my WCF Service will add an item in the SP List through COM. When the WCF is hosted in my computer using ASP.NET, it works fine. When hosted in another server in IIS, It returns an exception:

    The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
    
    Server stack trace: 
       at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       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 ITaskMgmtService.AddApplicationItem(String incidentNumber)
       at TaskMgmtServiceClient.AddApplicationItem(String incidentNumber)

    What is the problem?
    • Edited by okdreamy Tuesday, April 23, 2013 12:26 PM
    Tuesday, April 23, 2013 12:24 PM

All replies

  • Try adding your root SSL to SharePoint as a trust:

    http://<yourCA:port/_admin/ManageTrust.aspx


    MCITP-EA | "You don't understand anything until you learn it more than one way" | Hope This Helps!


    • Edited by ThatGuyRyan Tuesday, April 23, 2013 12:32 PM
    Tuesday, April 23, 2013 12:31 PM
  • The WCF Service is hosted over HTTP. Its the SharePoint that is over HTTPS.
    Tuesday, April 23, 2013 12:53 PM
  • Is there a binding for HTTP?

    MCITP-EA | "You don't understand anything until you learn it more than one way" | Hope This Helps!

    Tuesday, April 23, 2013 12:58 PM
  •         public void AddApplicationItem(string incidentNumber)
            {
                System.Net.NetworkCredential cred = new NetworkCredential("user", "pass", "domain");
                ClientContext context = new ClientContext(address);
                context.Credentials = cred;
                List list = context.Web.Lists.GetByTitle("BlablaList");
                ListItemCreationInformation newItem = new ListItemCreationInformation();
                ListItem listItem = list.AddItem(newItem);
                listItem["BlablaName"] = incidentNumber;
                listItem.Update();
                context.ExecuteQuery();
            }
      <system.serviceModel>
        <services>
          <service behaviorConfiguration="Service.Mgmt.TaskMgmtBehavior"
            name="Service.Mgmt.TaskMgmtService">
            <endpoint address="" binding="wsHttpBinding" contract="Service.Mgmt.ITaskMgmtService">
              <!--<identity>
                <dns value="localhost" />
              </identity>-->
            </endpoint>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="Service.Mgmt.TaskMgmtBehavior">    
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>


    Tuesday, April 23, 2013 1:25 PM
  • I was referring to SharePoint, is it only listening on 443?

    MCITP-EA | "You don't understand anything until you learn it more than one way" | Hope This Helps!

    Tuesday, April 23, 2013 1:40 PM
  • Yes it is only on 443. What is weird is when the service is hosted on my development machine, It can add an item to the list. When IIS hosted in other server it will throws the exception.
    • Edited by okdreamy Tuesday, April 23, 2013 1:47 PM
    Tuesday, April 23, 2013 1:45 PM
  • I guess I am confused as to why you can't bind to HTTPS in code?  Is HTTP listening on your dev machine?  netstat -an

    MCITP-EA | "You don't understand anything until you learn it more than one way" | Hope This Helps!

    Tuesday, April 23, 2013 2:21 PM
  • Yes my dev machine is listening... but there is no problem with my dev machine.

    Tuesday, April 23, 2013 2:31 PM