サーバーに次の web.config を持つ wcf サービスがあります。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="myconnection" connectionString="myconnectionstr"/>
</connectionStrings>
<system.serviceModel>
<services>
<service behaviorConfiguration="PSWebServis.PServisBehavior" name="PSWebServis.PServis">
<endpoint address="" binding="wsHttpBinding" contract="PSWebServis.IPServis" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PSWebServis.PServisBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
これは、クライアントの web.config の関連部分です。
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IPServis" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://sunucu:8000/PServis.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IPServis" contract="PSWebServis.IPServis"
name="WSHttpBinding_IPServis">
<identity>
<servicePrincipalName value="host/SUNUCU" />
</identity>
</endpoint>
</client>
これは、サービス内の私のインターフェースの一部です
[ServiceContract]
public interface IPServis
{
[OperationContract]
string InsertMusteri(MusterilerModel musteri);
}
およびサービスクラスの関連部分。
public class PServis : IPServis
{
public string InsertMusteri(MusterilerModel musteri)
{
if (musteri != null)
{
DataTable dtSonuc = new DataTable();
SqlCommand command = new SqlCommand("InsertMusteriModel", connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@musteriTablo", musteri.KayitTablosu);
command.Parameters.AddWithValue("@telefonTablo", musteri.TelefonKayit);
command.Parameters.AddWithValue("@adresTablo", musteri.AdresKayit);
connection.Open();
command.ExecuteNonQuery();
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dtSonuc);
connection.Close();
return dtSonuc.Rows[0]["IslemDurum"].ToString();
}
return "Başarısız";
}
}
私のムステリラーモデルクラス:
[DataContract]
public class MusterilerModel
{
[DataMember(Order=0)]
public int MusteriID { set; get; }
[DataMember(Order = 1)]
public string Ad { set; get; }
[DataMember(Order = 2)]
public string Soyad { set; get; }
[DataMember(Order=3)]
public string KullaniciAdi { set; get; }
[DataMember(Order = 4)]
public string Email { set; get; }
[DataMember(Order = 5)]
public DateTime DogumTarihi { set; get; }
[DataMember(Order=6)]
public string GrupAdi { set; get; }
[DataMember(Order=7)]
public int Renk { set; get; }
[DataMember(Order=8)]
public decimal Bakiye { set; get; }
[DataMember(Order=9)]
public string Adres { set; get; }
[DataMember(Order=10)]
public string AdresAciklamasi { set; get; }
[DataMember(Order=11)]
public string Firma { set; get; }
[DataMember(Order=12)]
public string VergiDairesi { set; get; }
[DataMember(Order=13)]
public string VergiNo { set; get; }
[DataMember(Order=14)]
public int BayiID { set; get; }
[DataMember(Order=15)]
public string Il { set; get; }
[DataMember(Order = 16)]
public string Ilce { set; get; }
[DataMember(Order = 17)]
public decimal YemekPara { get; set; }
[DataMember(Order=18)]
public string Sifre { set; get; }
[DataMember(Order=19)]
public int GrupID { set; get; }
[DataMember(Order=20)]
public string BayiAdi { set; get; }
[DataMember(Order=21)]
public int SehirID { set; get; }
[DataMember(Order=22)]
public int IlceID { set; get; }
[DataMember(Order=23)]
public DateTime EvlilikYilDonumu { set; get; }
[DataMember(Order=24)]
public DateTime KayitTarihi { set; get; }
[DataMember(Order=25)]
public string KayitEdenPersonel { set; get; }
[DataMember(Order=26)]
public int KayitEdenPersonelID { set; get; }
[DataMember(Order=27)]
public bool AktifMi { set; get; }
[DataMember(Order=28)]
public string Aciklama { set; get; }
[DataMember(Order=29)]
public string OzelKod { set; get; }
[DataMember(Order=30)]
public int SatisID { set; get; }
[DataMember(Order=31)]
public DataTable KayitTablosu { set; get; }
[DataMember(Order=32)]
public DataTable TelefonKayit { set; get; }
[DataMember(Order=33)]
public DataTable AdresKayit { set; get; }
}
InsertMusteri メソッドを使用しようとすると、データベースに 2 つのレコードがあります。ご覧のとおり、情報をデータテーブルに入れてサービスに送信します。データテーブルに複数の値があるかどうかを確認しましたが、それは問題ではありませんでした。どこに問題があるのかわからない。