将控制台应用程序转换为 ASP.NET Web 应用程序后,发布不再是即时的

发布于 2024-12-09 02:41:08 字数 3100 浏览 0 评论 0原文

我有一个控制台应用程序,它连接到一个服务引用,允许它向服务发送 SOAP 调用,该服务更新我不拥有或控制的单独程序中的信息。控制台应用程序运行良好,这里有一些代码只是为了让您了解我在做什么。

public static void PlaceOrders(wsCHRUtilsSoapClient client)
    {
        //identifying vars for patient/provider (not part of orders)
        string patientID = "1234";
        string csn = "123456789";
        string orderingUser = "98765";
        string authProvider = "98765";
        string departmentID = "123456";
        string projectKey = "eProj-CDS";
        string messages;

        //Create order samples
        Order oOne = CreateOrder("LAB", "CBCD", "1", "yay its friday", null, null, null, null, null, null, null, "4",
            "13", null, null, null, null, null, null, null, ", , , ", null, null, null, null, null, null, null, null, null);

        ArrayOfOrderOrder orders = new ArrayOfOrderOrder();
        orders.Add(oOne);

        client.PlaceOrders(patientID, csn, orderingUser, authProvider, departmentID, projectKey, orders, out messages);
    }

CreateOrder 方法只返回一个 Order 对象,它基本上是一个包含字符串和基于字符串的枚举的美化结构(由 Intellisense 建议,所以我知道它们从服务引用中是正确的)。它工作得非常好,我可以立即查看主机程序上发布的信息。

这是我的网络应用程序中的相同方法:

public void PlaceOrders(object sender, EventArgs e)
    {
        wsCHRUtilsSoapClient client = new wsCHRUtilsSoapClient("wsCHRUtilsSoap");
        string messages;
        string orderPatID = this.orderPatID.Text;
        string orderCSN = this.orderCSN.Text;
        string orderOrderingUser = this.orderOrderingUser.Text;
        string orderAuthProvider = this.orderAuthProvider.Text;
        string orderDeptID = this.orderDeptID.Text;
        string orderProjKey = this.orderProjKey.Text;

        string strOrderType = this.orderType.Text;
        string orderCode = this.orderCode.Text;
        string strQuantity = this.quantity.Text;
        string comment = this.comment.Text;
        // ...Like 25 more strings that call their respective ASP textboxes...
        string rflPriority = this.rflPriority.Text;
        string processingInstructions = this.processingInstructions.Text;

        ArrayOfOrderOrder orders = new ArrayOfOrderOrder();
        Order order = CreateOrder(strOrderType, orderCode, strQuantity, comment, strFutureStanding, strStandingCount, standingInterval, 
            expirationDate, strAutoRelease, futureExpectedDate, strFutureApproximate, priority, orderClass, strPatientTaking, route, strDaw, 
            strDispenseQuantity, dispenseUnit, strRefill, sig, modifiers, rflFromProviderID, rflToProviderID, rflToFacility, rflToSpecialty, 
            rflType, rflReason, strRflNumVisits, rflPriority, processingInstructions);

        orders.Add(order);

        client.PlaceOrders(orderPatID, orderCSN, orderOrderingUser, orderAuthProvider, orderDeptID, orderProjKey, orders, out messages);
        client.Close();

网络应用程序似乎偶尔更新程序。我无法找出调试模式或任何重要的东西,当它工作时,而不是当它不工作时。当它更新时,通常不是即时的。有人可以提供任何帮助吗?我对 C# 和 ASP.NET 还很陌生,因此我可能错过了正确设置 Web 应用程序服务引用的细微差别之一(尽管我很确定我对这两个应用程序都采用了相同的方式)。

我忘记了一些可能值得一提的事情:控制台应用程序有一个 Main,它只创建一个客户端并运行服务,然后退出。在我填写完表单并单击 ASP 按钮后,Web 应用程序将运行并执行该功能。

I have a console app which connects to a service reference that allows it to send SOAP calls to a service, which updates information in a separate program that I do not own or control. The console app works fine, and here is a bit of code just to give you an idea of what I'm doing.

public static void PlaceOrders(wsCHRUtilsSoapClient client)
    {
        //identifying vars for patient/provider (not part of orders)
        string patientID = "1234";
        string csn = "123456789";
        string orderingUser = "98765";
        string authProvider = "98765";
        string departmentID = "123456";
        string projectKey = "eProj-CDS";
        string messages;

        //Create order samples
        Order oOne = CreateOrder("LAB", "CBCD", "1", "yay its friday", null, null, null, null, null, null, null, "4",
            "13", null, null, null, null, null, null, null, ", , , ", null, null, null, null, null, null, null, null, null);

        ArrayOfOrderOrder orders = new ArrayOfOrderOrder();
        orders.Add(oOne);

        client.PlaceOrders(patientID, csn, orderingUser, authProvider, departmentID, projectKey, orders, out messages);
    }

CreateOrder method just returns an Order object, which is basically a glorified struct containing strings and enums based on strings (suggested by Intellisense so I know they're correct from the service reference). It works splendidly and I can immediately view the posted information on the host program.

Here's the same method in my web app:

public void PlaceOrders(object sender, EventArgs e)
    {
        wsCHRUtilsSoapClient client = new wsCHRUtilsSoapClient("wsCHRUtilsSoap");
        string messages;
        string orderPatID = this.orderPatID.Text;
        string orderCSN = this.orderCSN.Text;
        string orderOrderingUser = this.orderOrderingUser.Text;
        string orderAuthProvider = this.orderAuthProvider.Text;
        string orderDeptID = this.orderDeptID.Text;
        string orderProjKey = this.orderProjKey.Text;

        string strOrderType = this.orderType.Text;
        string orderCode = this.orderCode.Text;
        string strQuantity = this.quantity.Text;
        string comment = this.comment.Text;
        // ...Like 25 more strings that call their respective ASP textboxes...
        string rflPriority = this.rflPriority.Text;
        string processingInstructions = this.processingInstructions.Text;

        ArrayOfOrderOrder orders = new ArrayOfOrderOrder();
        Order order = CreateOrder(strOrderType, orderCode, strQuantity, comment, strFutureStanding, strStandingCount, standingInterval, 
            expirationDate, strAutoRelease, futureExpectedDate, strFutureApproximate, priority, orderClass, strPatientTaking, route, strDaw, 
            strDispenseQuantity, dispenseUnit, strRefill, sig, modifiers, rflFromProviderID, rflToProviderID, rflToFacility, rflToSpecialty, 
            rflType, rflReason, strRflNumVisits, rflPriority, processingInstructions);

        orders.Add(order);

        client.PlaceOrders(orderPatID, orderCSN, orderOrderingUser, orderAuthProvider, orderDeptID, orderProjKey, orders, out messages);
        client.Close();

The web app seems to sporadically update the program. I can't figure out a debug pattern or anything significant for when it works as opposed to when it doesn't. When it does update, it's usually not instantaneous. Can anybody offer any help?? I'm pretty new to C# and ASP.NET so there's a possibility I missed one of the nuances of correctly setting up the web app service reference (though I'm pretty sure I did it the same way for both applications).

Something I forgot that may be worth mentioning: The console app has a Main that just creates a client and runs the service, then exits. The web app runs and executes the function after I finish filling out the forms and click an ASP button.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

韶华倾负 2024-12-16 02:41:08

您应该确保 web.config 包含与控制台应用程序的服务的 app.config 相同的配置。

并且您应该验证是否将方法“PlaceOrders”绑定到某个事件处理程序(按钮单击或其他任何事情)

You should make sure that web.config contains the same configuration of your console app's app.config for the service.

And you should verify that you bound the method "PlaceOrders" to some event handler (Button click or any thing else)

余生一个溪 2024-12-16 02:41:08

事实证明,这是服务参考提供商方面的问题(尽管他们最初坚称不是)。感谢大家的投入!

As it turns out, it was a problem on the service reference provider's side (though they initially insisted it wasn't). Thanks for all of you input everyone!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文