Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Sunday, March 31, 2013 5:42 PM
I have a simple Custom Service Application that hosts a WCF service. the service has a simple method
[ServiceContract]
[XmlSerializerFormat]
public interface IWCFServiceContract
{
[OperationContract]
Client GetClient(int clientId);
[OperationContract]
DateTime GetCurrentDateTime();
}
service app methods look like this:
public Client GetClient(int clientId)
{
try
{
MonitoringDBDataContext ctx = new MonitoringDBDataContext(Database.DatabaseConnectionString);
return (from c in ctx.Clients
where c.Id == clientId
select c).Single();
}
catch (Exception ex)
{
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("xxxx", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
throw new FaultException(new FaultReason(ex.Message), new FaultCode(ex.InnerException.Message));
}
}
public DateTime GetCurrentDateTime()
{
return DateTime.Now;
}
From a client console application, I call the GetCurrentTime() method and it fails with "The service implementation object was not initialized or is not available". My client code is:
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });
DataContext _dc = new DataContext();
using (WCFServiceContractClient _ctx = new WCFServiceContractClient())
{
_ctx.ClientCredentials.Windows.ClientCredential = new NetworkCredential("xxxx", "xxxxx", "xxxx");
//Client client = _ctx.GetClient(1);
DateTime time = _ctx.GetCurrentDateTime();
}
i can do a _ctx.Open() with no issues, but when i call that very simple method, it fails. do note that im calling this over https. my bindings seem correct. but im accessing through a web app that has both http and extended to https. i expect to either use both http and https or just https.
All replies (2)
Tuesday, April 2, 2013 7:44 AM
>>but im accessing through a web app that has both http and extended to https. i expect to either use both http and https or just https.
It is a best practice to have http and https on seperate web application zone through by extending sharepoint web application. That is, you will find two IIS sites in IIS Manager for the same SharePoint web application.
Tuesday, April 2, 2013 2:37 PM
Yes, and that is how I have it set up. Sorry if that wasnt clear. Default Zone is 80/http and extranet zone is 443/https