我 - 再次 - 我的WebAPI应用程序中的一个问题.
我试图在不同版本的IIS(7,7.5,8)上部署.较新版本似乎有.json的全局MIME处理程序,而旧版本则没有.json.
当IIS找不到MIME处理程序时,该文件不存在.因此,对于旧版本,我在web.config中创建了一个本地MIME处理程序.棘手的部分是:如果它找到其中两个(一个全局和一个本地),它就会停止工作 - 即使它们都相同,IIS也不知道选择哪一个(wtf!?)并且只会抛出错误.
我是否可以在web.config中应用一个开关,该开关指出只有在此扩展名没有其他MIME的情况下才会使用MIME?
如果没有,我可以告诉VisualStudio部署不同版本的web.config,具体取决于部署配置文件 - 和/或我可以在web.config中应用基于IIS版本的交换机吗?
UserList 是一个词典列表,如:
[
{Name:"Alex",Age:25},
{Name:"Peter",Age:35},
{Name:"Muhammad",Age:28},
{Name:"Raul",Age:29}
]
Run Code Online (Sandbox Code Playgroud)
RowColorList 是一个颜色列表: [#bcf,#fc0]
新UserList应包含一个RowColor为每名,从顺序拍摄RowColorList:
[
{Name:"Alex",Age:25,RowColor:#bcf},
{Name:"Peter",Age:35,RowColor:#fc0},
{Name:"Muhammad",Age:28,RowColor:#bcf},
{Name:"Raul",Age:29,RowColor:#fc0}
]
Run Code Online (Sandbox Code Playgroud)
我尝试了以下代码:
UserList.Zip(RowColorList,(user,color) => user.Add("RowColor",color))
Run Code Online (Sandbox Code Playgroud)
使用此代码,new UserList将只包含任意数量的条目RowColorList.RowColorList每当可用的颜色用完时,我希望他从头开始.怎么样?
在我的安装程序中,我必须对架构进行微小的更改:
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[UserProfiles]') AND name = 'AllCheckboxesChecked')
BEGIN
ALTER TABLE [dbo].[UserProfiles] ADD [AllCheckboxesChecked] [bit] CONSTRAINT [DF_UserProfiles_AllCheckboxesChecked] DEFAULT 0 NOT NULL
UPDATE [dbo].[UserProfiles] SET [AllCheckboxesChecked]=1 WHERE [CheckedBoxes] LIKE '%#ALL#%'
END
GO
Run Code Online (Sandbox Code Playgroud)
在SSMS中,这可以工作,但在高级安装程序中没有,它失败并显示AllCheckboxesChecked列不存在的错误消息.所以我尝试过:
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[UserProfiles]') AND name = 'AllCheckboxesChecked')
BEGIN
ALTER TABLE [dbo].[UserProfiles] ADD [AllCheckboxesChecked] [bit] CONSTRAINT [DF_UserProfiles_AllCheckboxesChecked] DEFAULT 0 NOT NULL
GO
UPDATE [dbo].[UserProfiles] SET [AllCheckboxesChecked]=1 WHERE [CheckedBoxes] LIKE '%#ALL#%'
END
GO
Run Code Online (Sandbox Code Playgroud)
但是这也会引发语法错误(不在SSMS中,只在AdvInst中),所以我想 …
我已将Windows计算机上的cordova从8.0.0升级到8.1.1,现在尝试构建android版本时出现以下错误:
cordova build android
Cannot find module 'xcode'
Run Code Online (Sandbox Code Playgroud)
降级到8.0.0后,它可以再次工作。
我该怎么办才能解决该问题?
我有一个使用默认Lotus Notes http登录的Lotus Notes应用程序.
在我们的开发人员服务器上,Notes有一个html表单,用于将登录请求发送到names.nsf
<form method="post" action="/names.nsf?Login" name="_DominoForm">
Run Code Online (Sandbox Code Playgroud)
并且同样注销,调用
/names.nsf?LogOut
Run Code Online (Sandbox Code Playgroud)
我们在其他Notes服务器上也发现了这种情况 - 但是,这是默认情况,那么还有什么可以期待的呢?
虽然登录是Notes自动显示的表单,但是注销按钮必须是我们的Web应用程序的一部分(在LotusScript中使用后端),并且我将链接硬编码到names.nsf.
现在,客户似乎使用了大量自定义的设置,其中登录和注销不使用names.nsf.我不知道他们为登录做了什么 - 但是当试图打电话时/names.nsf?LogOut,Access被拒绝了.
有没有什么办法可以通过编程方式找出用于登出用户的操作?如果没有,则必须在我们的后端完成注销(至少iNotes就这样做).如何将注释http注销编程到LotusScript Notes代理中?
我必须从头开始创建一个通用应用程序.首先是经典应用程序,在未来的某个时候,现代应用程序.我使用Cmd生成了应用程序.
我已经实现了经典应用程序所需的基础知识,拆分了可以在现代应用程序中重用的所有内容并将其放入共享目录中.问题是,现在,当我使用Cmd进行编译时,我得到了缺少依赖项的错误(因为现代应用程序中缺少视图,我仅为经典实现,但在共享代码中是必需的).
经典应用程序编译查找,但现代版本没有,如果经典应用程序构建过程中有任何错误,没有人会注意到,因为现代投掷错误.
我可以在命令行上告诉Cmd只编译经典工具包吗?
我滥用Web.config文件作为某些Windows服务exe文件的配置文件,因为该服务通常需要与IIS相同的设置:
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
if (File.Exists("..\\Web.config"))
{
var path = Path.GetFullPath("..\\Web.config");
logger.Info("Web.config gefunden in {0}", path);
AppConfig.Change(path);
}
Run Code Online (Sandbox Code Playgroud)
有人尝试加密Web.config文件的一部分:
aspnet_regiis -pe connectionStrings -app /ourapp
Run Code Online (Sandbox Code Playgroud)
将原始App.config重命名为Web.config并重新命名似乎是Microsoft推荐的加密App.config文件的方法:
https://weblogs.asp.net/jongalloway/encrypting-passwords-in-a-net-app-config-file
但是,Windows服务无法启动:
Anwendung:MyService.exe
Framework版本:v4.0.30319
Beschreibung:Der Prozess wurde aufgrund einer未经授权的Ausnahme熟人。
提示信息:System.Configuration.ConfigurationErrorsException
bei System.Configuration.RsaProtectedConfigurationProvider.ThrowBetterException(Boolean)
bei System.Configuration.RsaProtectedConfigurationProvider.GetCryptoServiceProvider(Boolean, Boolean)
bei System.Configuration.RsaProtectedConfigurationProvider.Decrypt(System.Xml.XmlNode)
bei System.Configuration.ProtectedConfigurationSection.DecryptSection(System.String, System.Configuration.ProtectedConfigurationProvider)
bei System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.DecryptSection(System.String, System.Configuration.ProtectedConfigurationProvider, System.Configuration.ProtectedConfigurationSection)
bei System.Configuration.Internal.DelegatingConfigHost.DecryptSection(System.String, System.Configuration.ProtectedConfigurationProvider, System.Configuration.ProtectedConfigurationSection)
bei System.Configuration.BaseConfigurationRecord.CallHostDecryptSection(System.String, System.Configuration.ProtectedConfigurationProvider, System.Configuration.ProtectedConfigurationSection)
bei System.Configuration.RuntimeConfigurationRecord.CallHostDecryptSection(System.String, System.Configuration.ProtectedConfigurationProvider, System.Configuration.ProtectedConfigurationSection)
bei System.Configuration.BaseConfigurationRecord.DecryptConfigSection(System.Configuration.ConfigXmlReader, System.Configuration.ProtectedConfigurationProvider)
Run Code Online (Sandbox Code Playgroud)
提示信息:System.Configuration.ConfigurationErrorsException
bei System.Configuration.BaseConfigurationRecord.EvaluateOne(System.String[], System.Configuration.SectionInput, Boolean, System.Configuration.FactoryRecord, System.Configuration.SectionRecord, System.Object)
bei System.Configuration.BaseConfigurationRecord.Evaluate(System.Configuration.FactoryRecord, System.Configuration.SectionRecord, System.Object, Boolean, Boolean, System.Object ByRef, System.Object ByRef) …Run Code Online (Sandbox Code Playgroud) 我的WebAPI收到两个字符串,一个包含显示值(名称),一个包含隐藏值(电子邮件).
之前,它只收到一个字符串,它使用了foreach,我不确定如何使用它,如何填写"nameslist"中的"name":
[System.Web.Http.HttpGet]
public AjaxAnswer BatchUserCreate(string email, string names) {
string[] emaillist = email.Split('\n');
string[] nameslist = names.Split('\n');
foreach(string email in emaillist) {
db.AddParameter("@email",email);
db.AddParameter("@name",name);
int newId = db.ExecuteScalar(userInsQuery);
}
return new AjaxAnswer(newId);
}
Run Code Online (Sandbox Code Playgroud) 我有一个DateTimeOffset?对象,我想根据某种日期时间格式进行格式化。
我发现类型DateTimeOffset有ToString(String,IFormatProvider)方法:
http://msdn.microsoft.com/de-de/library/bb351892(v=vs.110).aspx
但是对于 类型的对象来说DateTimeOffset?,这也不存在,我也找不到这种类型的细节,或者如何转换它。
什么是DateTimeoffset?,如何使用自定义格式将其转换为字符串?
我想知道在某个DELETE操作中删除了多少行.
我把微软例B是
DELETE Sales.ShoppingCartItem
OUTPUT DELETED.*
WHERE ShoppingCartID = 20621;
Run Code Online (Sandbox Code Playgroud)
并尝试修改它只返回count已删除的记录:
DELETE FROM datacache
OUTPUT COUNT(DELETED.*)
WHERE userId=@id
Run Code Online (Sandbox Code Playgroud)
但这引发了
ExceptionMessage: "Incorrect syntax near '*'."
ExceptionType: "System.Data.SqlClient.SqlException"
Message: "Error"
Run Code Online (Sandbox Code Playgroud)
所以我试过了
DELETE FROM datacache
OUTPUT COUNT(DELETED)
WHERE userId=@id
Run Code Online (Sandbox Code Playgroud)
哪个扔了
ExceptionMessage: "Invalid column name 'DELETED'."
ExceptionType: "System.Data.SqlClient.SqlException"
Message: "Error"
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
c# ×4
sql-server ×2
cordova ×1
extjs ×1
extjs6 ×1
iis ×1
linq ×1
lotus-domino ×1
lotus-notes ×1
lotusscript ×1
mime-types ×1
sql ×1
t-sql ×1