Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>well ...</p> <pre><code>var thread = new Thread(() =&gt; { // your action }); thread.Start(); </code></pre> <p>but you will have problems with that:</p> <ul> <li>what if the import to sql fails? should there be any response to the client</li> <li>if it fails, how do you ensure the file on a later request</li> <li>what if the applications shuts down ... this newly created and started thread will be killed either</li> <li>...</li> </ul> <p>it's not always a good idea to store everything in sql (especially files...). if you want to make the file available to several servers why not distribute them via ftp ...?</p> <p>i believe that your whole concept is a bit messed up (sry assuming this), and it might be helpful if you elaborate and give us more information about your intentions!</p> <p><strong>edit:</strong></p> <blockquote> <p>Can I do / should I being doing this with a windows service? if so, how?</p> </blockquote> <p>you can :) i advise you to create a simple console-program and convert this with <code>srvany</code> and <code>sc</code>. you can get a rough overview howto <a href="http://social.technet.microsoft.com/Forums/en-US/winserverMigration/thread/98a97aee-c62b-4683-94ab-3777899cf7de" rel="nofollow noreferrer">here</a> (note: insert blanks after <code>=</code>... that's a silly pitfall)</p> <p>the term <code>should</code> is relative, because you did not answer the most important question</p> <blockquote> <p>what if a record is persisted to the database, telling a consumer that file <code>test.img</code> should be persisted, but your service hasn't captured it or did not transform it yet?</p> </blockquote> <p>so ... next on</p> <blockquote> <p>Should I use WCF? If this runs under IIS, will I have problems with aspnet_wp.exe recycling and timing out my process?</p> </blockquote> <p>you probably could create a WCF-service which recieves some binary-data and then stores this to a database. this request could be async. yes. but what for?</p> <p>once again: please give us more insight to your workflow: what are you exactly trying to achieve? which "environmental-conditions" to you have (eg. app A polls db and expects file-records which are referenced in table x to be persisted) ...</p> <p><strong>edit:</strong><br> so you want to import a <code>.csv</code>-file. well that changes everything :)</p> <p>but i won't advise you to use a wcf-service (there <em>could</em> be a usage: eg. a wcf-service which has a method to insert a single row, then your iteration through the file would be implemented in another app... not that good, though). </p> <p>i would suggest following:<br> at first do everything in your webapp (as you've already done), but rather use some sort of bulk-insert and do your transformation/logic on the database.</p> <p>if you have some sort of bottle-neck then, i would suggest you something like a minor job-service, eg:</p> <p>webapp will upload the file and insert a row to a job-table. the job-service is continiously polling the table/or gets informed via wcf by the webapp (hey, hey, finally some sort of usage for WCF in your scenario... :) ) and then does the import-job, writing a finish-note to a table/or set the state of the job to finished ...<br> but this is a bit overkill :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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