简体   繁体   English

从.ASPX页删除代码后,WCF服务在启动时调用Javascript代码

[英]WCF Service Calls Javascript Code On Start After Removing the Code from the .ASPX Page

I have a C# .NET WCF project that consists of a JavaScript page that calls a service. 我有一个C#.NET WCF项目,其中包含一个调用服务的JavaScript页面。 Upon start-up (in debug mode) it immediately calls the service, but I can not figure out why. 在启动时(在调试模式下),它会立即调用服务,但我想不出为什么。 To attempt to troubleshoot the issue I have performed the standard things, such as cleaning and rebuilding. 为了尝试解决该问题,我已经执行了标准的操作,例如清理和重建。 I also have deleted the projects dll's under the Windows directory. 我还删除了Windows目录下的项目dll。 To further emphasize the point, I deleted all of the Javascript in the .aspx file, but it still appears to retain it. 为了进一步强调这一点,我删除了.aspx文件中的所有Javascript,但似乎仍保留了它。 I know this because the call stack is pulling the function call with the variables populated, even though they are not there. 我知道这是因为调用堆栈正在使用填充的变量拉动函数调用,即使它们不存在。

What can cause this? 是什么原因造成的? How should I go about clearing out the code, since it's no longer there? 由于代码不再存在,我应该如何清除代码? I think it's a good place to start, as the other issue of calls at startup may be solved. 我认为这是一个很好的起点,因为启动时可能会解决其他问题。

You should definitely use the REST protocol anyway. 无论如何,您绝对应该使用REST协议。 This ensures that other non-ASP.net websites can consume your service (interoperability). 这样可以确保其他非ASP.net网站也可以使用您的服务(互操作性)。

Is there any particular reason why you're using WCF for this? 为什么要为此使用WCF? It would be easier to use MVC 4.0 with the REST API. 将MVC 4.0与REST API一起使用会更容易。 WCF is more suited to heavy lifting with Data contracts etc but it is not very interoperable. WCF更适合使用数据合同等进行繁重的工作,但它并不是非常可互操作的。

In response to your question, what is the VS project configured to use as a start item? 在回答您的问题时,VS项目配置为用作开始项?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM