NetworkFileSystem - File_WriteBinary Error

NetworkFileSystem - File_WriteBinary Error

  

Hello,

I'm using the NetworkFileSystem component in my eSpace, and when I try to save a file it gives the error "Operation Failed".
The directory exists, and right now has permissions for Everyone with full access. I'm using a valid domain\username and password in the parameters.
Any idea why this might be happening?

Thanks in advance

Ana Santana
Hi Ana,

have you checked the Error Log in Service Center? If so, what message are you getting?

RNA

Yes, I've checked the error log...
No error is showing... In the Extension Log I see the Action File_WriteBinary being called, and if I debug in Service Studio, I see that the result of the action is "Operation Failed". But no other error is showing anywhere...


Hi,

Check if you have the Anti-virus running in that folder and if it is locking the file when creating.

RNA

That was it!
I didn't have any information in any log (Service Center, Windows, or Anti-Virus logs)...
But I added the directory to the anti virus exceptions, and it worked fine.

Thank you very much for your help!

Ana Santana
I'm glad i could help.

RNA

Hi,

After all, it isn't working, but I found the problem.
I just don't know how to solve it...

I'm using several actions of the NetworkFileSystem component in a Import Files process of my application.
This import process lists and reads hundreds of directories and files in a matter of seconds, and after a non-specified-number of disk accesses, windows starts denying the logons. The file I'm attemptint to write is a log file of the whole process, and that was why the process wasnt writting it, it was in the end of all this process, and windows had long ago started denying access. The test I made yesterday was a simply write teste in a teste flow, and of course it was a first logon and didn't have a problem.

The errors windows have in event viewer are:

Event Type:    Warning
Event Source:    LsaSrv
Event Category:    None
Event ID:    6035
Date:        08-07-2010
Time:        11:38:51
User:        N/A
Computer:    XXXXX
Description:
During a logon attempt, the user's security context accumulated too many security IDs. This is a very unusual situation.  Remove the user from some global or local groups to reduce the number of security IDs to incorporate into the security context.
User's SID is S-1-5-20
If this is the Administrator account, logging on in safe mode will enable Administrator to log on by automatically restricting group memberships.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Event Type:    Failure Audit
Event Source:    Security
Event Category:    Logon/Logoff
Event ID:    537
Date:        08-07-2010
Time:        11:38:36
User:        NT AUTHORITY\SYSTEM
Computer:    XXXXX
Description:
Logon Failure:
     Reason:        An error occurred during logon
     User Name:    NETWORK SERVICE
     Domain:        NT AUTHORITY
     Logon Type:    9
     Logon Process:    Advapi  
     Authentication Package:    Negotiate
     Workstation Name:    
     Status code:    0xC000015A
     Substatus code:    0x0
     Caller User Name:    NETWORK SERVICE
     Caller Domain:    NT AUTHORITY
     Caller Logon ID:    (0x0,0x2FEFC80)
     Caller Process ID:    4760
     Transited Services:    -
     Source Network Address:    -
     Source Port:    -


For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Any ideas?

thanks in advance,

Ana Santana

Hi Ana,

let me try to help this one too...

Probably what you need is to run your application with another user instead of using the default ones from IIS.

Create a local user account on the server and go to service center. In that espace you have the operation tab and use the credentials to run the application. See the image


Remember to click in Apply "Run As" Settings, and i think you'll have your problem solved.

RNA

Hi...
It isn't working.
I used a domain account, and gave it "Log on as service" and "Log on as batch job" Security Settings in the machine.
I also gave it the security setting "Impersonate a CLient After Authentication"
I removed all authentication settings from the network file system actions, and published the espace
Then I added the run-as setting and republished the espace.
I can use the site without a problem, but when I click the import button, the site gives me the error:

Event Type:    Warning
Event Source:    ASP.NET 2.0.50727.0
Event Category:    Web Event
Event ID:    1309
Date:        08-07-2010
Time:        13:37:52
User:        N/A
Computer:    XXXXX
Description:
Event code: 3005 Event message: An unhandled exception has occurred. Event time: 7/8/2010 1:37:52 PM Event time (UTC): 7/8/2010 12:37:52 PM Event ID: d9085a482da54ae28142cf0c480fed8e Event sequence: 18 Event occurrence: 1 Event detail code: 0  Application information:     Application domain: /LM/W3SVC/1/Root/WFP_CustomerManageme-4-129230662238825281     Trust level: Full     Application Virtual Path: /WFP_CustomerManageme     Application Path: C:\Program Files\OutSystems\Platform Server\running\WFP_CustomerManageme.1413889627\     Machine name: XXXXX Process information:     Process ID: 2640     Process name: w3wp.exe     Account name: NT AUTHORITY\NETWORK SERVICE  Exception information:     Exception type: HttpException     Exception message: An error occurred while attempting to impersonate.  Execution of this request cannot continue.  Request information:     Request URL: http://XXXXX/WFP_CustomerManageme/Import_AccountOpenings.aspx?(Not.Licensed.For.Production)&_=1278592656054     Request path: /WFP_CustomerManageme/Import_AccountOpenings.aspx     User host address: XXXXXX     User: DOMAIN\my_user    Is authenticated: True     Authentication Type: Negotiate     Thread account name: DOMAIN\USER_I_CONFIGURED_IN_SERVICE_CENTERThread information:     Thread ID: 1     Thread account name: DOMAIN\USER_I_CONFIGURED_IN_SERVICE_CENTER     Is impersonating: False     Stack trace:    at System.Web.ImpersonationContext.GetCurrentToken()
   at System.Web.ImpersonationContext.get_CurrentThreadTokenExists()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
   at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
  Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Ana,

did you try  with a local user too? Some user with a small number of groups?

If it won't work, probably you'll have to resign your flow to reduce the number of access to the files. Can you add an example espace?

RNA
The reason I had to reset the Run As option was because LBPM stopped working with a user set...
It kept giving me impersonation errors and wouldn't create my workflow processes.

The user I was using only belonged to the "Domain Users" group, as it was created specifically to address the file access situation, so I don't believe the number of groups might be the problem. The problem is that I'm really importing a large number of files at each time.

I decided to let it be for the time being, and divide the files imported in reasonable chunks so it doesn't give me any error.
I know it's not an optimal solution, but right now I'm quite tight in time to finish this implementation...

Thank you anyway for all your help!
I now understand a bit more of the Outsystems platform. ;-)