我最近添加Microsoft.AspNet.WebApi.WebHost
了一个MVC WebAPI项目,它允许我[Route("api/some-action")]
在我的操作中使用该属性.我使用这篇文章解决了一些错误但无法解决下面的第三个错误.如果我做错了,请在下面添加已解决的错误以获得反馈.
第一个错误:在控制器'X'上找不到与名称'some-action'匹配的操作
解决方案:添加config.MapHttpAttributeRoutes();
到WebApiConfig.cs Register
方法.
第二个错误:System.InvalidOperationException该对象尚未初始化.确保在所有其他初始化代码之后在应用程序的启动代码中调用HttpConfiguration.EnsureInitialized().
解决方案:添加GlobalConfiguration.Configure(WebApiConfig.Register);
到Global.asax.csApplication_Start
第三个错误:System.ArgumentException:名为"MS_attributerouteWebApi"的路由已在路径集合中.路线名称必须是唯一的.
解决方案 =?
我已经尝试过根据这篇文章清理和删除bin文件夹中的所有DLL .
我在通用应用程序解决方案的Windows Phone 8.1项目中创建了一个名为PivotPage.xaml的新基本页面.当我在共享分区下转到App.xaml时,我想将下面代码中的HubPage更改为新创建的PivotPage.但VS拒绝承认PivotPage
合法类型.两个页面的命名空间和类定义完全相同.
if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
{
throw new Exception("Failed to create initial page");
}
Run Code Online (Sandbox Code Playgroud)
如果还有其他方法可以更改默认页面,请告诉我.
使用 Microsoft Visual Studio Professional 2019 版本 16.4.1
IntelliSense 在 左侧显示一个星形图标IsNullOrEmpty
。不知道是什么意思。
编辑1:
这不仅仅是IsNullOrEmpty
编辑 2
它只显示if()
语句中的星号
@Html.TextAreaFor(model => model.DESCRIPTION, 20, 50, new { htmlAttributes = new { @class = "form-control"} })
问题:上面的代码正确显示 textarea 的行和列,但下面的代码忽略行/列并显示每个浏览器的默认大小。下面的代码有什么问题?
new
以下代码中的额外内容是在创建 MVC 实体框架控制器时由 VS 自动创建的(如http://www.asp.net/mvc/overview/releases/mvc51-release-notes 中所述)
@Html.TextAreaFor(model => model.DESCRIPTION, new { htmlAttributes = new { @class = "form-control", @rows="20", @cols="50"} })
我们有一个 dotnet core 3.1 Web API 应用程序,该应用程序发布到 Windows 2012 R2 数据中心虚拟机上托管的 IIS 10。
该应用程序在没有托管代码的应用程序池下运行:
IIS 无法读取 web.config。这是我在 IIS 中单击此应用程序的连接字符串时得到的结果:
网络配置
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<authorization>
<remove users="" roles="mydomain\mydevrole" verbs="" />
<add accessType="Allow" users="?" roles="" />
</authorization>
</security>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud) 在我的ASP.NET MVC4应用程序中,我正在使用表单身份验证.应用程序中的一个视图需要通过jQuery post()
调用获取一些字符串数据.我写了一个返回字符串的动作.一切正常,直到表单身份验证票证到期.到期后,对字符串操作的AJAX调用导致以下结果:
jqXHR.done()
而不是jqXHR.fail()
这是预期的行为吗?我能做些什么来让动作返回401吗?或者我还应该做些什么来处理这个问题?
据我了解,您可以通过执行“新建项目”>“ASP.NET Core Web 应用程序”>“[提供应用程序名称]”>“Web 应用程序”在 Visual Studio 2019 中创建 Razor Pages 应用程序
以下教程演示如何将 Azure Active Directory 身份验证添加到 MVC 应用程序。我让示例 MVC 应用程序可以运行。
我将本教程中的所有必要代码复制到 Razor Pages 应用程序(Program.cs 和 Startup.cs)中,但我没有收到任何身份验证提示。这是否意味着 Razor 页面不受支持?或者我做错了什么?
https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-aspnet-core-webapp
asp.net-mvc azure azure-active-directory asp.net-core razor-pages
我在http://code.msdn.microsoft.com/office365/Office-365-Manage-users-by-cfc96d5e上使用代码通过测试c#web应用程序连接到Office 365,该应用程序基本上连接到azure活动目录和尝试执行几个powershell cmdlet.
我在我的Web应用程序中的Connect-MsolService cmdlet上的Pipeline.Invoke方法上遇到此异常:
抛出了"Microsoft.Online.Administration.Automation.MicrosoftOnlineException"类型的异常.
至今:
我可以使用相同的帐户在同一台计算机上使用Windows PowerShell的Microsoft Online Services模块成功执行connect-msolservice并运行cmdlet.
我还能尝试什么?
json字符串
{
"success": true,
"challenge_ts": "2016-11-03T17:30:00Z",
"hostname": "mydomain.com"
}
Run Code Online (Sandbox Code Playgroud)
类
internal class reCaptchaResponse
{
internal bool success { get; set; }
internal DateTime challenge_ts { get; set; } // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
internal string hostname { get; set; } // the hostname of the site where the reCAPTCHA was solved
internal string[] error_codes { get; set; } // optional
}
Run Code Online (Sandbox Code Playgroud)
尝试序列化
reCaptchaResponse responseObject = Newtonsoft.Json.JsonConvert.DeserializeObject<reCaptchaResponse>(jsonResult);
Run Code Online (Sandbox Code Playgroud)
尝试失败像......
Newtonsoft.Json.JsonConvert.SerializeObject(responseObject)
回报
{}
尝试将 TFS 2018 升级到 DevOps Server 2019。卡在准备情况检查屏幕上。它要我删除 elasticsearch 服务。
服务已停止。
并且服务属性中提到的路径,特别是搜索文件夹,不存在C:\Program Files\Microsoft Team Foundation Server 2018\Search\ES\elasticsearchv5\bin\elasticsearch-service-x64.exe //RS//elasticsearch-service-x64
不存在。
无法service -remove
从 bin 文件夹运行。
相关日志:
[Info @07:49:10.510] +-+-+-+-+-| Running Service Not Installed: Verifying the following Windows service is not installed: elasticsearch-service-x64 |+-+-+-+-+-
[Info @07:49:10.511]
[Info @07:49:10.511] +-+-+-+-+-| Verifying the following Windows service is not installed: elasticsearch-service-x64 |+-+-+-+-+-
[Info @07:49:10.511] Starting Node: VSEARCHSERVICENOTINSTALLED
[Info @07:49:10.511] NodePath : VINPUTS/Conditional/Progress/Conditional/VSEARCHSERVICENOTINSTALLED
[Info @07:49:10.511] Verifying that the following service is NOT …
Run Code Online (Sandbox Code Playgroud) 使用 iTextSharp,您可以通过将事件附加到 PDF 来向 PDF 添加页眉/页脚,如此 SO 答案中所述:https : //stackoverflow.com/a/19004392
我怎样才能用 iText 7 做同样的事情?
此链接有 Java 代码示例,但似乎不像使用页面事件。
c# ×7
asp.net-mvc ×2
azure ×2
.net-core ×1
asp.net-core ×1
iis ×1
intellisense ×1
itext7 ×1
json ×1
json.net ×1
ms-office ×1
powershell ×1
razor ×1
razor-pages ×1
tfs ×1
wpf ×1
xaml ×1