私はかなり新しいwf4ですが、サブミット、承認、拒否の機能を備えたシンプルなコンソールアプリケーションを作成しました。私は今作成したサービスを消費するasp.netアプリケーションを作成しようとしていますが、以下に示すように障害例外が発生しています。これは私のコンソールアプリでうまく機能しましたasp.netとwf4の相関関係の例外
The execution of an InstancePersistenceCommand was interrupted because
the instance key '3a552603-c92f-2424-085c-7b6fc1a0e98e' was not associated to
an instance
基本的に3つの単純なページが作成されました。最初のページはユーザーがリクエストを送信する簡単なフォームです。 2ページ目にはリクエストのリストが表示されます。いずれかの要求をクリックすると3番目のページに進み、承認および拒否ボタンを使用して要求の詳細を表示します。私はクエリ文字列を介して3番目のページに渡される相関のGUIDを使用しています。 [承認]ボタンをクリックすると、クエリ文字列の値を渡すサービスの承認メソッドが起動されます。その時点で私は例外を取得します。エラーメッセージにGUIDです奇妙なことは、渡す値イムと同じではありません。
以下のすべてのアイデアは私のコードであることは
1ページ目を助けている
protected void Unnamed1_Click(object sender, EventArgs e) {
ServiceReference1.ServiceClient Client = new ServiceReference1.ServiceClient();
ServiceReference1.Request R = new ServiceReference1.Request();
R.Title = TxtRequestTitle.Text;
R.Amount = Convert.ToInt32(TxtAmount.Text);
Guid g = Guid.NewGuid();
Client.SubmitRequest(R, g);
Response.Write("submitted");
}
2ページ目
protected void Page_Load(object sender, EventArgs e) {
using (SqlConnection con = new SqlConnection(@"Data Source=bantai11\sqlexpress;Initial Catalog=RequestMonkey;Integrated Security=True;Asynchronous Processing=True")) {
using (SqlCommand com = new SqlCommand()) {
com.Connection = con;
com.CommandType = System.Data.CommandType.Text;
com.CommandText = "Select InstanceId, Title, state from Requests";
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(com);
sda.Fill(dt);
rp.DataSource = dt;
rp.DataBind();
}
}
}
3ページ目
protected void Page_Load(object sender, EventArgs e) {
this._id = Request.QueryString.Get("Id");
using (SqlConnection con = new SqlConnection(@"Data Source=bantai11\sqlexpress;Initial Catalog=RequestMonkey;Integrated Security=True;Asynchronous Processing=True")) {
using (SqlCommand com = new SqlCommand()) {
con.Open();
com.Connection = con;
com.CommandType = System.Data.CommandType.Text;
com.CommandText = "Select InstanceId, Title, state from Requests where instanceid = '" + this._id + "'";
SqlDataReader dr = com.ExecuteReader();
dr.Read();
lblTitle.Text = dr[1].ToString();
lblGuid.Text = dr[0].ToString();
lblAmount.Text = "0";
}
}
}
protected void btnApprove_Click(object sender, EventArgs e) {
ServiceReference1.ServiceClient Client = new ServiceReference1.ServiceClient();
Client.Approve(1, this._id);
}