在窗口服务中执行Web服务时出现问题 [英] Problem in executing a Web Service in a Window Service

查看:77
本文介绍了在窗口服务中执行Web服务时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我正在运行一个窗口服务,其中将数据从访问表中提取到数据表中,然后借助 foreach 循环;在同一项目的 bin/debug 文件夹中创建一个XML文件,并将具有ID和详细信息的相同信息写入 XML文件.

现在,Window服务将从XML文件中读取数据,并且特定身份的ID和详细信息将通过Web服务(我已将其添加到window服务中的引用)发送到Web方法.
但是,当我调用Web方法时,窗口服务无法将xml文件复制(或创建)到指定的文件夹中,并且出现错误,例如:-错误2无法复制文件" obj \ Debug \ TrackingSystem.exe"更改为"bin \ Debug \ TrackingSystem.exe".
该进程无法访问文件"bin \ Debug \ TrackingSystem.exe",因为它正在被另一个进程使用.跟踪系统
"
:(

出现异常错误的原因如下:客户端发现响应内容类型为"application/wsdl + xml",但预期为"text/xml"." .

今天出现的异常是:"

Dear Friends,

I am running a window service in which the data is fetched from the access sheet into a datatable and then with the help of foreach loop; A XML file is created in the bin/debug folder of the same project and the same information with the Id and Details is written into the XML file.

Now the Window service will read the data from the XML file and the ID and details for a particular person will be sent to a web method through a web service (of which reference I have added into the window service).

But when I am calling the web method, the window service is not able to copy(or create) the xml file into the specified folder and an error is coming like:- "Error 2 Unable to copy file "obj\Debug\TrackingSystem.exe" to "bin\Debug\TrackingSystem.exe".
The process cannot access the file ''bin\Debug\TrackingSystem.exe'' because it is being used by another process. TrackingSystem
"
:(

The exception error is coming as: "Client found response content type of ''application/wsdl+xml'', but expected ''text/xml''.".

Today exception is coming as: "

System.Web.Services.Protocols.SoapException: Server was unable to process request. --->
System.Data.DataException: Connection must be valid and open
   at executeOperations.insertRecords(String strSQLQuery) in d:\webServiceForPHP\App_Code\connectionClassForMySQL.cs:line 95
at Service.insertStudentDetails(Int32 userId, String dateTime, String inOutStatus)
in d:\webServiceForPHP\App_Code\Service.cs:line 27
   --->
 End of inner exception stack trace --->


"
.

如果我不使用Web方法(通过Web服务),则窗口服务运行得非常好.

请帮助:)

谢谢

Varun Sareen
Software Developer


"
.

The window service is running absolutely fine if I don''t use the Web Method (through web service).

Kindly help :)

Thanks

Varun Sareen
Software Developer

推荐答案

大卫,

检查复制文件的位置是否具有足够的权限来复制它.您甚至可以检查权限,然后尝试将其粘贴到此处.
Hi David,

Check if the location where you copy the file to has enough permissions to copy it. You can even check the permission and try to paste it there.


亲爱的朋友们,

感谢所有的好建议,但我自己解决了这个问题.实际上,我每隔 1秒就会调用一次窗口服务,并且Web服务没有太多时间来打开与MYSQL的连接.

因此,我增加了窗口服务调用的时间,从而解决了问题.

Varun Sareen
软件开发人员
Dear Friends,

Thanks to all for the nice suggestions but i solved the problem myself. Actually I was calling the window service after every 1 sec and the web service was not getting much time to open the connection to MYSQL.

So, i increased the time of the window service call and hence the problem is solved.

Varun Sareen
Software Developer


这篇关于在窗口服务中执行Web服务时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆