我收到了错误; MVC Microsoft JScript运行时错误:Sys.ArgumentTypeException:类型为"Sys._Application"的对象无法转换为类型'Sys._Application'.Parameter name:instance
我在我的MVC应用程序中收到此错误,我想知道它是否与升级到ie8有关?我没有在FF中遇到问题.当我发帖子时,调试器在MicrosoftAjax.debug.js文件中找到错误.
因为我在MVC工作,通常的解决方案; 将ScriptMode设置为Release不适用.
因为我在视图中使用Knockout,所以我相应地设置了表单标签;
<form class="employeeListEditor" data-bind="submit: save">
Run Code Online (Sandbox Code Playgroud)
但是,当我单击提交按钮时,我想要部分页面刷新.那么如何在Ajax.BeginForm中设置data-bind属性呢?
这种语法不起作用;
<% using (Ajax.BeginForm("GetCalendar", new AjaxOptions { UpdateTargetId = "siteRows" }, new { data-bind="submit: save", class="employeeListEditor" }))
{%>
Run Code Online (Sandbox Code Playgroud) 当我在TFS中构建我的项目时,它无法找到实体框架,但当我查看文件夹时它就在那里;
我收到这些错误消息;
Build started 14/02/2013 15:44:50.
Project "C:\Builds\1\SCD\SCD - New Test\Sources\MVC\SCD\SCD.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Builds\1\SCD\SCD - New Test\Sources\MVC\SCD\SCD.sln" (1) is building "C:\Builds\1\SCD\SCD - New Test\Sources\MVC\SCD\SCD\SCD.csproj" (2) on node 1 (default targets).
EntityDeployNonEmbeddedResources:
Skipping target "EntityDeployNonEmbeddedResources" because it has no outputs.
EntityDeployEmbeddedResources:
Processing 1 EDMX files.
Starting to process input file 'Models\SCD.edmx'.
Finished processing input file 'Models\SCD.edmx'.
Finished processing 1 EDMX files.
Project "C:\Builds\1\SCD\SCD - New Test\Sources\MVC\SCD\SCD\SCD.csproj" (2) is building "C:\Builds\1\SCD\SCD - …Run Code Online (Sandbox Code Playgroud) 我当时正在研究这个问题。System.UnauthorizedAccessException:检索Word Interop的COM类工厂失败,错误80070005。
为了使Word Interop可以在其上工作,我们在测试服务器中安装了word。这导致了这个新错误,并且我无法应用在Componenet Services DCOM Config上找不到Microsoft Word所建议的修复程序。那么我该如何解决呢?
我正在使用jqAutocomplete插件,我想在一行表中使用它.
我无法让它发挥作用.自动填充选择标签不会出现.它只允许我输入1个字母.
我正在使用knockout映射将服务器端视图模型映射到客户端视图模型.
页面呈现得很好.对于新表单 - 如本例所示 - 代码生成10个空行(未显示).我想使用自动完成功能从JobName列的列表中选择合同.
我在这里复制了viewmodals,减少了以便更容易理解;
父视图模型:
public class WholeViewModel : BaseViewModel
{
public WholeViewModel(int employeeId, string name;)
: base()
{
this.Lines = new List<LineViewModel>();
this.Contracts = SessionObjectsSTAS.GetContracts().Select(x => new ContractViewModel { ContractId = x.ContractId, JobName = x.JobName, Label = x.ToString() }).ToList();
this.EmployeeId = employeeId;
this.Name = name;
}
public int EmployeeId { get; set; }
public string Name { get; set; }
public List<ContractViewModel> Contracts { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
Lines Collection由此viewmodal组成:
public class LineViewModel
{ …Run Code Online (Sandbox Code Playgroud) 我正在测试Web Core API,我收到500内部服务器错误.我控制器上的方法是;
[Route("api/property")]
public class PropertyController : BaseSirController
{
[HttpPost("{contractId}/saveproperty")]
public IActionResult SaveProperty(int contractId, [FromBody] PropertyContractDto property)
{
if (property == null)
{
return BadRequest();
}
if (contractId == 0)
{
return NotFound();
}
return Ok();
//return CreatedAtRoute("GetPropertyInspectionsForContract", new {contractId = contractId}, properties);
}
Run Code Online (Sandbox Code Playgroud)
在我的POwershell命令中输入:
Invoke-RestMethod http://localhost:17972/api/property/7/saveproperty -Method POST -Body (@{UPRN="1244"; StreetName="The Street"; AddressLine2="ALine2"; AddressLine3="ALine3"; AddressLine4="ALine4"; Postcode="N1 7PL"; Latitude="23"; Longitude="77"; BlockUPRN="B1244"; PropertyNo="23"; BlockName="Wenlock Court"; Comments="blah blah blah"; PropertyTypeId="1"; NumberOfBathrooms="1"; NumberOfBedrooms="2"; NumberOfKitchens="1"; PropertyContractId="23"; PropertyType="Maisonette"} | ConvertTo-Json) -ContentType "application/json"
Run Code Online (Sandbox Code Playgroud)
我得到的错误信息是;
Invoke-RestMethod …Run Code Online (Sandbox Code Playgroud) 我想将一个整数集合发送到web核心api上的post方法.
方法是;
[HttpPost("open")]
public IActionResult OpenInspections([FromBody]IEnumerable<int> inspectionIds)
{
return NoContent();
//...
Run Code Online (Sandbox Code Playgroud)
这只是为了测试,我在return语句和inspectionIds有效负载上设置了一个断点null.
在Postman我有
编辑:我刚从签名中删除了方括号.我试图既IEnumerable<int>和int[],但都没有成功
我正在使用 Web Core API 并按如下方式设置 CORS;
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
...
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
var url = Configuration["origenUrl"];
var header = "Content-Type";
app.UseCors(
options => options.WithOrigins(url).WithHeaders(header).AllowAnyMethod().AllowCredentials()
);
}
Run Code Online (Sandbox Code Playgroud)
此设置适用于获取请求。但对于我的 Put 请求;
$.ajax({
url: url,
method: "PUT",
xhrFields: { withCredentials: true }
})
.done(callback)
//.fail(errorMessage);
.fail(function (jqXHR, textStatus, errorThrown) {
alert("Something went wrong: " + textStatus + " " + errorThrown);
errorCallback();
});
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息;
XMLHttpRequest 无法加载http://localhost:17972/api/fault/1/close。
对预检请求的响应未通过访问控制检查:请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,不允许访问来源“ http://localhost:12528 ”。响应的 …
自从我从 VSTS 发布版本以来已经有一段时间了,但我在解决如何发布版本时遇到了问题。我已经有了一个定义 Sir-TestGeneric1。当我尝试为该定义创建版本时,我没有获得工件的任何版本。我尝试输入 BuildId,但仍然收到此处显示的错误消息;
当我查看构建定义时,我收到此消息;
为此设置的权限在哪里?
应该是一个容易回答的问题.我试图在视图中创建一个对象.包含该对象的类由User类和密码组成.当我单击提交按钮时,Controller会为Password和User选择空值.请参阅下面的Container类,Controller和View;
public class UserExtended
{
public UserITOC User { get; set; }
public string Password { get; set; }
}
[Authorize]
public ActionResult Create()
{
return View(new UserExtended());
}
//
// POST: /Dinners/Create
[Authorize(Roles = "Administrator")]
[HttpPost]
public ActionResult Create(UserExtended user)
{
if (ModelState.IsValid)
{
// Create user in the User datatable
SqlUsersRepository sqlRepository = new SqlUsersRepository();
ITOCEntities db = new ITOCEntities();
db.UserITOCs.AddObject(user.User);
// Create user as an authenticated user within the Reader role.
int i = user.User.EmailAddress.IndexOf('@') - 1; …Run Code Online (Sandbox Code Playgroud) asp.net-mvc ×4
c# ×4
knockout.js ×2
.net-core ×1
ajax ×1
asp.net ×1
asp.net-core ×1
azure-devops ×1
build ×1
com ×1
jquery ×1
postman ×1
powershell ×1
preflight ×1
tfs2010 ×1