Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with an ASMX Web Method that uses File I/O
    text
    copied!<p>Right now I am working on a stub of a project. In the course of the project I need to be able to from a web front end set a message on a server to and then from an iPhone Query the Server to read the message.</p> <p>While all the individual peices are working and my request is going through fine I am having trouble using this webmethod </p> <pre><code>[WebMethod()] public void setMessage(string message) { FileStream file = new FileStream("mymessage.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter sw = new StreamWriter(file); sw.Write(message); sw.Close(); file.Close(); } </code></pre> <p>When I invoke this via HTTP Post using SOAP from an iPhone app. </p> <p>I get the following xml in my console when I make the request.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;soap:Body&gt; &lt;soap:Fault&gt; &lt;faultcode&gt;soap:Server&lt;/faultcode&gt; &lt;faultstring&gt;Server was unable to process request. ---&amp;gt; Access to the path 'c:\windows\system32\inetsrv\myMessage.txt' is denied.&lt;/faultstring&gt; &lt;detail /&gt; &lt;/soap:Fault&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>The Server is one configured by my boss, that is currently being used in other capacities as an in house test server for several different projects.</p> <p>The server is an IIS server I do not know what version, with ASP.NET configured and installed.</p> <p>The script is located in a different place than the program is trying to write. I assume that the script is being run from that directory and that is why it is trying to write there. Is that the case or am I missing something fundamental?</p> <p>If there are any alternative suggestions as to how I could go about this I would love to hear them as well, as I am working of a pretty small knowledge base.</p> <p>Thanks! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload