小编use*_*351的帖子

无法加载文件或程序集'Microsoft.Web.Infrastructure,

我试图将我的网站上传到服务器.它与我的本地主机一起工作正常,所以我将localhost wwwroot文件夹中的所有内容上传到服务器并更改了连接字符串.

但是有这个错误:

Exception information: 
    Exception type: InvalidOperationException 
    Exception message: The pre-application start initialization method Start on type RouteDebug.PreApplicationStart threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
   at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods)
   at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc

73
推荐指数
8
解决办法
20万
查看次数

视觉工作室2013'添加控制器'缺失

我将visual studio 2010项目更新到visual studio 2013.然后我想要一个新的控制器.但是没有添加控制器选项.

在此输入图像描述

但如果我在2013年创建一个新项目,它已经有了添加控制器选项.那么如何添加新的Controller呢?web.config中缺少的东西或缺少引用?

asp.net-mvc visual-studio

22
推荐指数
2
解决办法
2万
查看次数

在Gridview中显示SQL数据库中的数据

我想在SQL数据库中使用3个表在网格视图中显示数据.

首先我创建了模型

public class common
    {

        public Artist Artist { get; set; }
        public Album Album { get; set; }
        public Genre Genre { get; set; }

    }
Run Code Online (Sandbox Code Playgroud)

然后这是控制器

 public ActionResult Show1()
    {
        var query = from a in DB.Album
                    join b in DB.Artists
                    on a.ArtistId equals b.ArtistId
                    join c in DB.Genre
                    on a.GenreId equals c.GenreId
                    where (b.ArtistId == 2)
                    select new common { Album = a, Artist = b, Genre = c };
        return View(query.ToList());
    }

}
Run Code Online (Sandbox Code Playgroud)

之后,这是我的观点

@model …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc gridview

8
推荐指数
1
解决办法
2万
查看次数

如何获得控制器的按钮值?

我有视图,它有两个按钮,分别是'是'和'否'.如果我点击"是"重定向一个页面,如果我点击"否"重定向到另一个页面.

这是我的观点.

@using (Html.BeginForm())
 { 
<table  >
 <tr>
    <td >
      Ceremony : 
    </td>
    <td>
       Ceremony at @Model.ceremony_date

    </td>
</tr>

  <tr>
            <td >
              Name :
            </td>
            <td >
               @Model.first_name  @Model.middle_name  @Model.last_name
            </td>
        </tr>
        <tr>
         <td colspan="2" >
            @Html.Partial("_DegreeDetailsByGraduand", @Model.DegreeList)
         </td>
        </tr>

        <tr>
        <td colspan="2" >
        IS information is correct ?
        </tr>
        <tr>
        <td>
         <input type="submit" id="btndegreeconfirmYes" name="btnsearch" class="searchbutton"  value="Yes" />    
         </td>  <td>
          <input type="submit" id="btndegreeconfirmNo" name="btnsearch" class="searchbutton"  value="No" /></td>  
        </tr>
</table>


 }
Run Code Online (Sandbox Code Playgroud)

这是我的控制器

[HttpPost]

        public ActionResult CheckData()
        {

            return RedirectToRoute("detailform");
        } …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc

7
推荐指数
1
解决办法
2万
查看次数

如何只验证7位数?

我正在使用mvc.所以我想验证用户输入的数字是7位数.

所以我写了一堂课.

 public class StduentValidator : AbstractValidator<graduandModel>
    {
        public StduentValidator(ILocalizationService localizationService)
        {                          
           RuleFor(x => x.student_id).Equal(7)
               .WithMessage(localizationService
                    .GetResource("Hire.graduand.Fields.student_id.Required"));                   
        }
Run Code Online (Sandbox Code Playgroud)

但它没有用.如何验证7位数字?

c# asp.net-mvc fluentvalidation

6
推荐指数
1
解决办法
1万
查看次数

服务器对象错误'ASP 0177:800401f3'Server.CreateObject失败

我正在使用经典ASP.

Set theForm = Server.CreateObject("Persits.Upload")
theForm.OverwriteFiles = True
Run Code Online (Sandbox Code Playgroud)

运行上面的代码会产生错误:

Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题?

vbscript asp-classic

6
推荐指数
1
解决办法
6万
查看次数

如何在visual studio 2010中创建测试证书?

我正在使用visual studio 2010.我需要在Signing选项卡中添加测试证书.

但"创建测试证书"按钮被禁用.怎么了?如何激活它或如何创建测试证书?

在此输入图像描述

visual-studio-2010

6
推荐指数
1
解决办法
1336
查看次数

错误"字符串参数太长".在microsoft.office.interop.word.find.execute

我想用C#创建一个世界文档.所以这是我替换word文档变量的代码.

 private void FindAndReplace(Microsoft.Office.Interop.Word.Application WordApp, object findText, object replaceWithText) 
 {
    try {
        object matchCase = true;
        object matchWholeWord = true;
        object matchWildCards = false;
        object matchSoundsLike = false;
        object nmatchAllWordForms = false;
        object forward = true;
        object format = false;
        object matchKashida = false;
        object matchDiacritics = false;
        object matchAlefHamza = false;
        object matchControl = false;
        object read_only = false;
        object visible = true;
        object replace = 2;
        object wrap = 1;

        WordApp.Selection.Find.Execute(ref findText,
        ref matchCase, ref matchWholeWord,
        ref matchWildCards, …
Run Code Online (Sandbox Code Playgroud)

c# asp.net office-interop

5
推荐指数
2
解决办法
3385
查看次数

如何验证电话号码?

我正在使用 MVC,我想验证电话 否

我写了这个类:

public class StduentValidator : AbstractValidator<graduandModel>
{
    public StduentValidator(ILocalizationService localizationService)
    {
        RuleFor(x => x.phone).NotEmpty().WithMessage(localizationService.GetResource("Hire.HireItem.Fields.phone.Required"));
    }
}
Run Code Online (Sandbox Code Playgroud)

如何验证此类中的电话号码?

我可以使用以下吗?

RuleFor(x => x.phone).SetValidator(....)
Run Code Online (Sandbox Code Playgroud)

如果是这样,我该如何使用它??

c# asp.net-mvc

4
推荐指数
2
解决办法
5134
查看次数

如何使用Linq"NOT IN"

我正在使用实体框架
所以我想使用两个表 - tblContractor和tbSiteByCont表编写一个sql命令.它在SQL中看起来像这样

SELECT     PKConID, Fname, Lname
FROM         tblContractor
WHERE     (PKConID NOT IN
                          (SELECT     FKConID
                            FROM          tbSiteByCont
                            WHERE      (FKSiteID = 13)))
Run Code Online (Sandbox Code Playgroud)

但我不知道怎么写Linq.

我试过这样的

  var query1 = from s in db.tblSiteByConts   
                        where  s.FKSiteID == id
                        select s.FKConID;


            var query = from c in db.tblContractors   
                        where c.PKConID != query1.Any()
                        select Contractor;
Run Code Online (Sandbox Code Playgroud)

但这不起作用.那我该怎么写呢?程序是什么?我是Linq的新手.

.net c# linq

4
推荐指数
1
解决办法
3万
查看次数