什么
我使用.NET framework 3.5创建了一个非常简单的asp.net Web服务,当我使用单元测试进行测试时,它运行正常.现在我想在IIS上托管它,因为我为它准备了一个Web设置项目.
并在安装此项并在iis上进行测试后添加了Web服务项目的内容文件和主要输出.
问题
当我尝试使用浏览器运行Web服务时,我收到以下错误
HTTP错误500.19 - 内部服务器错误无法访问请求的页面,因为页面的相关配置数据无效.
我试过了什么? 我尝试更改IIS_Users的安全权限以允许读写全部,尝试更改应用程序池版本,现在我正在尝试使用默认的.NET framework 4版本.
代码我认为web.config是罪魁祸首因此我在这里粘贴它...
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="cString" connectionString ="Data Source=VRAKSH-YASSER;Initial Catalog=uGraphDB;Persist Security Info=True;User ID=sa;Password=data#123;MultipleActiveResultSets=True" />
</connectionStrings>
<!--<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, …Run Code Online (Sandbox Code Playgroud) 我有下面的HTML.我想做的事情取决于某些条件.我想继续改变文本Sometitle.
<div id="header">
Sometitle
<div>
<div>
aa
</div>
<div>
bb
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试使用下面的Jquery,但它也删除了其他div.
$("#header").text("Its a thrusday today !");
Run Code Online (Sandbox Code Playgroud)
我怎么做到这一点?在任何情况下我都无法修改此HTML.我只需要使用jquery并完成这件事.
这是我创建的一个jsfiddle:http://jsfiddle.net/qYUBp/
我正在尝试测试一个根据 window 对象中存在的值返回值的类。
window.test = 123;
我想将 window 对象的 test 属性模拟为 123 值以便能够正确测试。
我试过Object.defineProperty,使用 global 代替,但似乎没有任何效果。似乎是一个微不足道的问题,但无法在谷歌或其他地方找到答案。请指教。
我正在使用带有Web Api的ASP.NET MVC 4
我有以下ApiController.
public class ProductsController : ApiController
{
public List<Product> GetProducts()
{
return _productService.GetAllProducts();
}
public List<Product> GetProductsFromId(string username)
{
return _productService.GetProductsFromUsername(username);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,如果你在GetProductsFromId(string username)这里看到第二个动作,我需要先传递用户名(即从MVC 3升级之前)我User.Identity.Username用来获取用户名.
在这种情况下我应该如何处理这个问题.
如何传递用户名?有什么我可以做的.
此外,我不想User.Identity.Username在GetProductFromId(string username)方法内部使用,因为它将打败使用web api的整个目的,也不会被测试.
请指导我帮助我.谢谢
我正在使用之前使用ASP.NET Web Forms构建的网站,现在使用ASP.NET MVC构建.
我们上周制作了新的MVC版本.
但是旧的登录网址www.website.com/login.aspx已被许多用户收藏,他们仍然使用它,因此他们得到404错误.
所以我想知道哪个是将用户从旧网址重定向到新的mvc网址的最简单最好的方法,即www.website.com/account/login
就像这个登录网址一样,我希望用户可能还有其他几个网址的书签,那么处理这个问题的最佳方法是什么?
我正在使用HTML Agility Pack来验证我的HTML.以下是我正在使用的,
public class MarkupErrors
{
public string ErrorCode { get; set; }
public string ErrorReason { get; set; }
}
public static List<MarkupErrors> IsMarkupValid(string html)
{
var document = new HtmlAgilityPack.HtmlDocument();
document.OptionFixNestedTags = true;
document.LoadHtml(html);
var parserErrors = new List<MarkupErrors>();
foreach(var error in document.ParseErrors)
{
parserErrors.Add(new MarkupErrors
{
ErrorCode = error.Code.ToString(),
ErrorReason = error.Reason
});
}
return parserErrors;
}
Run Code Online (Sandbox Code Playgroud)
所以说我的输入如下所示:
<h1>Test</h1>
Hello World</h2>
<h3>Missing close h3 tag
Run Code Online (Sandbox Code Playgroud)
所以我的当前函数返回以下错误列表
- Start tag <h2> was not found
- End tag …Run Code Online (Sandbox Code Playgroud) 我使用angular bootstrap实现了一个bootstrap模式,工作正常.
这是我用过的代码的plunker链接.
在我的模态中,我只有一个输入字段(文本框)需要由用户填写,并有一个保存和取消按钮.我希望在显示模态时文本框应该具有焦点.
我尝试了autofocus在这种情况下无效的属性.
下面粘贴的是模态上的html.
<div class="modal-header panel panel-heading">
<button type="button" class="close" ng-click="ok()">×</button>
<h4 class="modal-title">Add Project</h4>
</div>
<div class="modal-body">
<input autofocus="autofocus" type="text" class="form-control" id="ProjectName" placeholder="Enter project name here" data-ng-model="ProjectName" tab-index="1"/>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()" tab-index="2">Create</button>
<button class="btn btn-default" ng-click="cancel()" tab-index="3">Cancel</button>
</div>
Run Code Online (Sandbox Code Playgroud)
我如何让它工作?
我已经阅读了http://schema.org/price(微数据示例),我想在我的其中一个页面上使用。
这是我感兴趣的,我想显示价格/价格范围
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<!--price is 1000, a number, with locale-specific thousands separator
and decimal mark, and the $ character is marked up with the
machine-readable code "USD" -->
<span itemprop="priceCurrency" content="USD">$</span><span
itemprop="price" content="1000.00">1,000.00</span>
<link itemprop="availability" href="http://schema.org/InStock" />In stock
</div>
Run Code Online (Sandbox Code Playgroud)
现在,在页面上选择某些选项之前,我的页面不显示任何价格,但是我确实有一个基本价格(最低),我想在这种情况下使用它。
如何以及在何处注入此基本价格的正确位置?
我在https://search.google.com/structured-data/testing-tool上试过这个,它有效。不确定这是否是正确的方法?
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="priceCurrency" content="USD" />
<meta itemprop="price" content="2.31" />
</div>
Run Code Online (Sandbox Code Playgroud)
请指教。
我正在使用 .net core 3+ Web api。
下面是我的操作的样子,它使用 HTTP GET,我想传递几个字段,其中一个字段是整数列表。
[HttpGet]
[Route("cities")]
public ActionResult<IEnumerable<City>> GetCities([FromQuery] CityQuery query)
{...}
Run Code Online (Sandbox Code Playgroud)
这是CityQuery课程 -
public class CityQuery
{
[FromQuery(Name = "stateids")]
[Required(ErrorMessage = "stateid is missing")]
public string StateIdsStr { get; set; }
public IEnumerable<int> StateList
{
get
{
if (!string.IsNullOrEmpty(StateIdsStr))
{
var output = StateIdsStr.Split(',').Select(id =>
{
int.TryParse(id, out var stateId);
return stateId;
}).ToList();
return output;
}
return new List<int>();
}
}
}
Run Code Online (Sandbox Code Playgroud)
有没有一种通用方法可以用来接受整数列表作为输入而不接受字符串然后解析它?
或者有更好的方法来做到这一点吗?我尝试谷歌搜索但找不到太多。提前致谢。
我使用ASP.NET MVC和Jquery,这似乎是一个jquery错误.
我正在对我的方法进行ajax调用,我的代码是
$('.reopenBtn').live('click', function () {
var taskId = $(this).attr("data-taskid");
$.ajax({
url: '/Task/ReopenTask/?strTaskId=' + taskId,
type: "POST",
success: function (data) {
// this does not work !!
$(this).parent().parent().closest("div").remove();
},
error: function (xhr, ajaxOptions, thrownError) {
alert('Error');
}
});
});
Run Code Online (Sandbox Code Playgroud)
在remove这个问题创建的jsfiddle时不工作,但在这里,这个工程.
那么,$(this)在ajax调用的成功函数中有什么不同吗?
我该如何解决这个问题?谢谢
jquery ×3
asp.net ×2
angularjs ×1
asp.net-core ×1
asp.net-mvc ×1
c# ×1
html ×1
javascript ×1
jestjs ×1
microdata ×1
reactjs ×1
schema.org ×1
web-services ×1
webforms ×1