首页 \ 问答 \ 如何使用相同的数据源发布多个Lightswitch HTML项目(How to publish multiple Lightswitch HTML projects using the same data source)

如何使用相同的数据源发布多个Lightswitch HTML项目(How to publish multiple Lightswitch HTML projects using the same data source)

我在2012 Server上使用IIS 8.5,在同一台机器上使用Visual Studio和SQL Server。

我已经构建并发布了一个Lightswitch HTML客户端,它在Web浏览器中运行良好。 它是一个内部应用程序,可以在http:// servername / htmlclient上的域计算机上访问/工作。 这是Lightswitch发布HTML内容的默认位置。

我还构建了第二个LS HTML项目。 它完全独立但使用相同的SQL数据源。 我似乎无法成功地将这个项目发布到网上。 老实说,我不确定它是否是一个Visual Studio / Lightswitch问题,一个IIS问题...我有点迷失为什么它不能“正常工作”,就像我发布的第一个应用程序一样。 即使考虑到我在尝试发布时遇到的错误,我也不确定如何解决问题。

对于新项目生成web.config文件似乎存在问题,或者可能与使用相同数据源的两个项目有关。 这是我在尝试在Web浏览器中查看第二个项目的内容时遇到的错误...

错误页面


I am using IIS 8.5 on a 2012 Server, with Visual Studio and SQL Server on the same machine.

I have built and published one Lightswitch HTML Client, and it is working fine from web browsers. It is an internal application and is accessible/working on domain computers at http://servername/htmlclient. This is the default location where Lightswitch publishes the HTML content.

I have also built a second LS HTML project. It is completely separate but uses the same SQL data source. I cannot seem to successfully publish this project to the web, at all. I am honestly not sure if it is a Visual Studio/Lightswitch issue, an IIS issue... I am kind of lost as to why it doesn't 'just work', like the first application I published. Even given the error I am seeing when I try to publish, I am not sure how to fix the issue.

It appears to be a problem with generating a web.config file for the new project, or maybe something to do with both projects using the same data source. This is the error I get when trying to view the content of the second project in a web browser...

Error page


原文:https://stackoverflow.com/questions/34291912
更新时间:2021-09-21 07:09

最满意答案

在第一个代码示例中,每次迭代都会创建一个新的SqlCommand

SqlCommand command = new SqlCommand(insertQuery, connection);

在第二个中,所有迭代都修改相同的命令,添加越来越多的参数。 只有第一个调用具有正确数量的参数,下一个调用具有太多参数。

在没有值的循环之前添加参数,然后在循环中设置值并执行命令

command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "InsertBets";

command.Parameters.Add("@FixtureId", SqlDbType.Int);
// add the other paramters

foreach (Bet bet in bets)
{
    command.Parameters["@FixtureId"].Value = bet.FixtureId;
    // set the other parameters
    command.ExecuteNonQuery();
}

In the first code sample a new SqlCommand is created in every iteration:

SqlCommand command = new SqlCommand(insertQuery, connection);

In the 2nd one, all iterations modify the same command, adding more and more parameters. Only the first call will have the correct number of parameters, the next ones have too many.

Add the parameters before the loop without values, then in the loop set the values and execute the command

command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "InsertBets";

command.Parameters.Add("@FixtureId", SqlDbType.Int);
// add the other paramters

foreach (Bet bet in bets)
{
    command.Parameters["@FixtureId"].Value = bet.FixtureId;
    // set the other parameters
    command.ExecuteNonQuery();
}

相关问答

更多
  • 我多选行然后使用此代码,当我在sql表中检查结果时,我发现此代码只考虑datagridview中的第一个选定行而忽略其余行。 这太正常了,因为在每次迭代中都使用与 DGV.SelectedRows[0] 相同的行单元格,而不是您迭代的行。 改变你的 OrderNumber = Convert.ToInt32(DGV.SelectedRows[0].Cells[0].Value); OrderDateTime = Convert.ToDateTime(DGV.SelectedRows[0].Cells[4]. ...
  • 在第一个代码示例中,每次迭代都会创建一个新的SqlCommand : SqlCommand command = new SqlCommand(insertQuery, connection); 在第二个中,所有迭代都修改相同的命令,添加越来越多的参数。 只有第一个调用具有正确数量的参数,下一个调用具有太多参数。 在没有值的循环之前添加参数,然后在循环中设置值并执行命令 command.Connection = connection; command.CommandType = CommandType.St ...
  • 最后我得到了解决方案。实际上问题是,在内联查询执行期间,行被限制为50000,因此它很容易显示所有行,但例程(存储过程)实际上是试图返回所有(16,000 * 16,000) MySQL工作台无法显示的行。因此,在执行存储过程期间,获取时间过长,这就是为什么它强制关闭的原因。 抱歉张贴错误的问题,并抱歉,如果我通过发布这个问题误导了你们任何一个。 无论如何谢谢你们。 Finally I got the solution.Actually the problem was that during the inl ...
  • 您使用while循环的想法应该可行。 你可以尝试这样的事情: IntPtr hWnd = IntPtr.Zero; bool isFound = false; while(!isFound) { foreach (Process procList in Process.GetProcess()) { if (procList.MainWindowTitle.Contains("SAP Logon")) { isFound = true; hWnd = ...
  • “不起作用”是什么意思? 您是否收到编译错误,运行时异常或只是意外的结果? 请在aska问题时始终指定。 什么是SPLogCountInUser方法的返回类型? 如果它是一个IEnumerable ,那么可以将Label的Content属性设置为第一项的字符串表示形式: HadishDataBaseEntities database = new HadishDataBaseEntities(); var All = database.SPLogCountInUser(HadishCode.gUserID). ...
  • 如果您确实无法更改存储过程,则可以使用游标创建循环。 除非绝对必要,否则我不会建议这个行动方案。 declare c cursor local read_only for select property_component_id from propertiestable declare @id open c fetch from c into @id while @@fetch_status=0 begin EXEC @return_value = [dbo].[p_CPGUploade ...
  • 也许db填充values调用已经打开了一个事务,阻止了内部调用的运行。 尝试在填充values的调用中使用.ToList()来预先加载所有值。 Perhaps the db call to populate values has opened a transaction, stopping the inside call functioning. Try using .ToList() in the call that populates values to preload all of the value ...
  • 不要在循环中执行那些SQL查询。 将它们组合在一个SQL语句中: $sql = 'SELECT a.konto_odbiorcy, a.nazwa, a.miasto, a.zip_code, a.ulica , max(e1.date) as date_le_curdate , min(e2.date) as date_ge_curdate FROM klienci_ax_all as a LEFT JOIN 3ce_event as e1 ON (a.konto_odbiorcy=e1.number A ...
  • 它失败的原因是你将参数传递给CREATE PROC部分: cmd.CommandText = @"CREATE PROC #AddCriteriaTable (@ParameterCode VARCHAR(64), @Value VARCHAR(64)) AS INSERT #CriteriaTable VALUES (@ParameterCode, @Value)"; cmd.Parameters.AddWithValue("@ParameterCode", request.Criteria.First( ...
  • 使用在循环中设置为true的布尔变量。 为简单起见,删除了不相关的代码: DECLARE found boolean default false; ... REPEAT FETCH loop_cur ... SET found = true; ... UNTIL done END REPEAT; -- found is now true if you got some rows, false otherwise Use a boolean variable that ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)