OxleyCreek

An error occurred while receiving the HTTP response to http://dc2piintf01.stanwell.com/PIWebServices/PITimeSeries.svc.

Discussion created by OxleyCreek on Jul 18, 2011
Latest reply on Jul 19, 2011 by Lonnie Bowling

I have set up PI web services and have written a C# program to test it out. I get the error below when I run the code. Visual Studio 2010 can find the web service OK all looks fine but I cannot get it to access PI. I have included the app.config info and the error log message from the Web server - can anyone tell me what is wrong?

 

Regards

 

Michael

 

 

 

 

 

class Program
    {
        static void Main(string[] args)
        {
            ServiceReference1.PITimeSeriesClient client = new ServiceReference1.PITimeSeriesClient();
            string[] tags = { @"pi:\\pims\sinusoid" };
            ServiceReference1.TimeSeries[] data = client.GetPISnapshotData(tags);

            client.Close();
          

        }
    }

 

 

 

Error Message from Visual Studio app

 

An error occurred while receiving the HTTP response to http://dc2piintf01.stanwell.com/PIWebServices/PITimeSeries.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

 

App.config

 

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="BasicEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
                    transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
      <behaviors>
        <endpointBehaviors>
          <behavior name="wsImpersonationBehavior">
            <clientCredentials>
              <windows allowedImpersonationLevel="Delegation" />
              <httpDigest impersonationLevel="Delegation" />
            </clientCredentials>
          </behavior>
        </endpointBehaviors>
      </behaviors>

      <client>
        <endpoint address="http://dc2piintf01.stanwell.com/PIWebServices/PITimeSeries.svc"
          binding="wsHttpBinding" bindingConfiguration="BasicEndpoint"
          contract="ServiceReference1.IPITimeSeries" name="BasicEndpoint"
          behaviorConfiguration="wsImpersonationBehavior">
          <identity>
            <servicePrincipalName value="HOST/DC2PIINTF01" />
          </identity>
        </endpoint>
      </client>
    </system.serviceModel>
</configuration>

 

 

 

Details from the error log on the Web server

 

Log Name:      Application
Source:        ASP.NET 2.0.50727.0
Date:          18/07/2011 4:44:21 PM
Event ID:      1334
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      DC2PIINTF01.stanwell.com
Description:
An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/1/ROOT/PIWebServices

Process ID: 1524

Exception: System.Runtime.InteropServices.SEHException

Message: External component has thrown an exception.

StackTrace:    at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at OSIsoft.RtBaseline.DataService.ThreadManager.InvokeInternal(Delegate method, Object[] args)
   at OSIsoft.RtBaseline.DataService.PIServers.Invoke(Boolean impersonate, Delegate method, Object[] args)
   at OSIsoft.RtBaseline.DataService.PIServers.GetDefaultServer()
   at OSIsoft.RtBaseline.DataService.PIServers.GetDefaultServerName()
   at OSIsoft.RtBaseline.Services.DataSourceTypes.PI.ExecuteQueries(IList`1 states)
   at OSIsoft.RtBaseline.Common.QueryProcessorImpl.ExecuteQueryImpl(QueryState[] states, Dictionary`2 cachedTimeConversions)
   at OSIsoft.RtBaseline.Common.QueryProcessorImpl.ExecuteQueries(DataQuery[] queries)
   at PIWebServices.PIDataService.PITimeSeriesSvcImpl.Execute(Object asyncResult)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="ASP.NET 2.0.50727.0" />
    <EventID Qualifiers="49152">1334</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2011-07-18T06:44:21.000000000Z" />
    <EventRecordID>2432</EventRecordID>
    <Channel>Application</Channel>
    <Computer>DC2PIINTF01.stanwell.com</Computer>
    <Security />
  </System>
  <EventData>
    <Data>An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/1/ROOT/PIWebServices

Process ID: 1524

Exception: System.Runtime.InteropServices.SEHException

Message: External component has thrown an exception.

StackTrace:    at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at OSIsoft.RtBaseline.DataService.ThreadManager.InvokeInternal(Delegate method, Object[] args)
   at OSIsoft.RtBaseline.DataService.PIServers.Invoke(Boolean impersonate, Delegate method, Object[] args)
   at OSIsoft.RtBaseline.DataService.PIServers.GetDefaultServer()
   at OSIsoft.RtBaseline.DataService.PIServers.GetDefaultServerName()
   at OSIsoft.RtBaseline.Services.DataSourceTypes.PI.ExecuteQueries(IList`1 states)
   at OSIsoft.RtBaseline.Common.QueryProcessorImpl.ExecuteQueryImpl(QueryState[] states, Dictionary`2 cachedTimeConversions)
   at OSIsoft.RtBaseline.Common.QueryProcessorImpl.ExecuteQueries(DataQuery[] queries)
   at PIWebServices.PIDataService.PITimeSeriesSvcImpl.Execute(Object asyncResult)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)</Data>
  </EventData>
</Event>

Outcomes