我在Windows Server 2008中有sql server 2008 r2.但是当我尝试启动"SQL Server Browser"服务时,我收到以下错误: -
"无法启动该服务,因为它已被禁用,或者因为它没有与之关联的已启用设备." 那么可能导致此错误的原因是什么?
我在我的控制器中有动作调用以下方法:
public IQueryable<AaaUserContactInfo> getcontactinfo(long[] id)
{
var organizationsiteids = from accountsitemapping in entities.AccountSiteMappings
where id.Any(accountid => accountsitemapping.ACCOUNTID == accountid)
select accountsitemapping.SITEID;
var usersdepts = from userdept in entities.UserDepartments
join deptdefinition in entities.DepartmentDefinitions on userdept.DEPTID equals deptdefinition.DEPTID
where organizationsiteids.Any(accountid => deptdefinition.SITEID == accountid)
select userdept;
var contactsinfos = from userdept in usersdepts
join contactinfo in entities.AaaUserContactInfoes on userdept.USERID equals contactinfo.USER_ID
select contactinfo;
return contactsinfos;
}
Run Code Online (Sandbox Code Playgroud)
但是当我运行应用程序并导航到action方法时,将在视图级别上引发以下错误: -
System.Data.EntityCommandExecutionException was unhandled by user code
HResult=-2146232004
Message=An error occurred while executing the command …Run Code Online (Sandbox Code Playgroud) 我有以下方法: -
public ActionResult CustomersDetails(string[] SelectRight)
{
var selectedCustomers = new SelectedCustomers
{
Info = SelectRight.Select(GetAccount)
};
return View(selectedCustomers);
}
private AccountDefinition GetAccount(string id)
{
return entities.AccountDefinition.Find(id);
}
Run Code Online (Sandbox Code Playgroud)
但它返回以下错误: -
The type of one of the primary key values did not match the type defined in the entity. See inner exception for details.
Run Code Online (Sandbox Code Playgroud)
就return entities.AccountDefinition.Find(id);行了
那是什么导致了这个错误?
内在的例外是: -
System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=The type of one of the primary key values did not match the …Run Code Online (Sandbox Code Playgroud) 我有以下设置:
IIS 7.我已将Web配置文件中的身份验证类型从表单更改为Windows,如下所示: -
但是当我尝试访问ASP.NET MVC站点时出现以下错误: -
访问被拒绝.描述:访问提供此请求所需的资源时发生错误.可能未配置服务器以访问请求的URL.
错误消息401.2.:未授权:由于服务器配置登录失败.验证您是否有权根据您提供的凭据和Web服务器上启用的身份验证方法查看此目录或页面.请与Web服务器的管理员联系以获取其他帮助.
版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.17929
可能是什么问题呢?
我有多个表用于存储我们的公司资产,这些表包括: -
• 车辆
•服务器
•电脑
•家具
现在,对于每个资产,我想创建一个查找表,存储资产模型,例如在创建新PC时,用户将选择模型"Dell vostro 350"等.但更好的是什么; 到限定四个查找表(如vechicle_model,Server_models,Pc_models,furniture_model),或定义一个查找表,并有一列描述其类型(类型= PC)
问候
我在asp.net mvc应用程序中有folloiwng动作方法: -
public ActionResult CustomersDetails(long[] SelectRight)
{
if (SelectRight == null)
{
ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
RedirectToAction("Index");
}
else
{
var selectedCustomers = new SelectedCustomers
{
Info = SelectRight.Select(GetAccount)
};
return View(selectedCustomers);
}
return View();
}
Run Code Online (Sandbox Code Playgroud)
但是如果它SelectRight Array是空的,那么它将绕过if (SelectRight == null)检查,它将呈现CustomerDetails视图并在视图内的以下代码上引发异常
@foreach (var item in Model.Info) {
<tr>
Run Code Online (Sandbox Code Playgroud)
那么如何使空检查工作正常呢?