I am having problems whenever I am trying to run my client app using SOAP or REST. No matter what, I seem to get rejected on the localhost. I verified I have the correct ports for both services so thought I would post some info here. The error I get is as follows when using my SOAP service:
The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET
I turned on the trace and my REST gets the following
No connection could be made because the target machine actively refused it 127.0.0.1:62928
The web service is defined as such
public string InsertPatientIDS(PATIENT_IDS patientInfo)
{
string message;
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = "\\SQLExpress";
builder.InitialCatalog = "pchr42563";
builder.IntegratedSecurity = true;
SqlConnection con = new SqlConnection(builder.ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("INSERT into PATIENT_IDS(PATIENT_ID,LAST_NAME,FIRST_NAME, DATE_OF_BIRTH,ADDRESS_STREET, ADDRESS_STATE, ADDRESS_CITY,ADDRESS_ZIP,PHONE_HOME,PHONE_MOBILE,PRIMARY_ID) values" +
"(@PATIENT_ID,@LAST_NAME,@FIRST_NAME,@DATE_OF_BIRTH,@ADDRESS_STREET, @ADDRESS_STATE, @ADDRESS_CITY,@ADDRESS_ZIP,@PHONE_HOME,@PHONE_MOBILE,@PRIMARY_ID)",con);
cmd.Parameters.AddWithValue("@PATIENT_ID", patientInfo.PATIENT_ID);
cmd.Parameters.AddWithValue("@LAST_NAME", patientInfo.LAST_NAME);
cmd.Parameters.AddWithValue("@FIRST_NAME", patientInfo.FIRST_NAME);
cmd.Parameters.AddWithValue("@DATE_OF_BIRTH", patientInfo.DATE_Of_BIRTH);
cmd.Parameters.AddWithValue("@ADDRESS_STREET", patientInfo.ADDRESS_STREET);
cmd.Parameters.AddWithValue("@ADDRESS_STATE", patientInfo.ADDRESS_STATE);
cmd.Parameters.AddWithValue("@ADDRESS_CITY", patientInfo.ADDRESS_CITY);
cmd.Parameters.AddWithValue("@ADDRESS_ZIP", patientInfo.ADDRESS_ZIP);
cmd.Parameters.AddWithValue("@PHONE_HOME", patientInfo.PHONE_HOME);
cmd.Parameters.AddWithValue("@PHONE_MOBILE", patientInfo.PHONE_MOBILE);
cmd.Parameters.AddWithValue("@PRIMARY_ID", patientInfo.PRIMARY_ID);
int result = cmd.ExecuteNonQuery();
if (result == 1)
{
message = patientInfo.PRIMARY_ID + " inserted successfully";
}
else
{
message = patientInfo.PRIMARY_ID + " not inserted successfully";
}
con.Close();
return message;
and is consumed as such in the client application
ServiceClient client = new ServiceClient();
PCHRSoapReference1.PATIENT_IDS patientInfo = new PCHRSoapReference1.PATIENT_IDS();
patientInfo.FIRST_NAME = txtFirst.Text;
patientInfo.LAST_NAME = txtLast.Text;
patientInfo.ADDRESS_STREET = txtAddress.Text;
patientInfo.ADDRESS_CITY = txtCity.Text;
patientInfo.ADDRESS_STATE = txtState.Text;
patientInfo.ADDRESS_ZIP = txtZip.Text;
patientInfo.PHONE_HOME = txtOffice.Text;
patientInfo.PHONE_MOBILE = txtMobile.Text;
patientInfo.PRIMARY_ID = txtPrimaryID.Text;
patientInfo.DATE_Of_BIRTH = dtpDate.Value;
//give a successful or unsuccessful result
string result = client.InsertPatientIDS(patientInfo);
MessageBox.Show(result);
The app.config is also given as
<client>
<endpoint address="http://localhost:62928/Service.svc" behaviorConfiguration="WebBehavior"
binding="webHttpBinding" contract="PCHRContracts.IPatientIDS" />
<endpoint address="http://localhost:59647/Service.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService" contract="PCHRSoapReference1.IService"
name="WSHttpBinding_IService">
<identity>
<userPrincipalName value="thebigreddudePC\thebigreddude" />
</identity>
</endpoint>
</client>
To make this more readable, I only posted the code for my SOAP service and not the REST because I believe the errors are related to something deeper.
If there is any clear syntax issues than I would appreciate the response. If it is more than likely a local comp issue, then please let me know as well. It has had remote connectivity issues in the past, but this is the first time I have done a localhost. Also, I am not using IIS, just the built in VS one.