我正在使用一個Web應用程序,其中用戶向服務傳遞一個參數,它將返回作爲查詢結果的字符串數據類型。在服務我使用實體框架查詢基於用戶輸入,但我無法得到的數據,而不是拋出例外在我的web應用說..... ..... 服務器無法處理請求由於內部錯誤。有關該錯誤的更多信息,請在服務器上打開IncludeExceptionDetailInFaults(來自ServiceBehaviorAttribute或來自配置行爲),以便將異常信息發送回客戶端,或根據Microsoft .NET Framework 3.0 SDK文檔啓用跟蹤並檢查服務器跟蹤日誌。 Web應用程序和服務是兩種不同的解決方案。 代碼在我的WCF服務無法使用實體框架從WCF服務獲取數據
public string GetFunctionality(string UserId)
{
string strRoleName = string.Empty;
objEntity = new SYMPHONY_TVEntities();
var Function = from t1 in objEntity.Users join t2 in objEntity.User_Role on t1.Role equals t2.User_Role1 where t1.UserID == UserId select t2;
var UserName = from it in objEntity.Users where it.UserID == UserId select it;
//Here i am getting exception
User_Role objRole = Function.First();
User objUser = UserName.First();
if (objRole.User_Function != null && objUser.User_Name != null)
{
strRoleName = objRole.User_Function + "$" + objUser.User_Name;
}
return strRoleName;
}
我的連接字符串,WCF服務
<add name="SYMPHONY_TVEntities" connectionString="metadata=res://*/UsersModel.csdl|res://*/UsersModel.ssdl|res://*/UsersModel.msl;provider=System.Data.SqlClient;provider connection string='Data Source=inhi1u-hd0212\;Initial Catalog="SYMPHONY TV";Integrated Security=True;MultipleActiveResultSets=True'" providerName="System.Data.EntityClient" /></connectionStrings>
DO [這](http://stackoverflow.com/a/8315680/860243)知道實際的異常。 – Flowerking 2013-04-04 12:02:47
我得到錯誤的底層提供者faild打開時如何解決它 – Jagadesh 2013-04-04 12:08:03
爲您正在調用的wcf操作提供一些代碼以拋出異常。 – Flowerking 2013-04-04 12:09:48