Bonjour,
j'ai crée un web service qui crée un fichier su le disque locale du serveur
cela marche bien en mode vs2008 mais quand je l'héberge sur iis5.1 ca genere une exception la voici:
System.UnauthorizedAccessException: L'accès au chemin d'accès 'c:\test_fichier.txt' est refusé.
à System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
à System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
à System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
à System.IO.File.Create(String path)
à FichierService.Service1.Fichier() dans C:\Documents and Settings\x\Mes documents\Visual Studio 2008\Projects\FichierService\FichierService\Service1.asmx.cs:ligne 30
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.IO; namespace FichierService { /// <summary> /// Summary description for Service1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class Service1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public void Fichier() { File.Create("c:/test_fichier.txt"); } } }
Partager