Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving settings throught the web UI fails #898

Closed
bveldkamp opened this issue Sep 17, 2021 · 6 comments · Fixed by #910
Closed

Saving settings throught the web UI fails #898

bveldkamp opened this issue Sep 17, 2021 · 6 comments · Fixed by #910

Comments

@bveldkamp
Copy link

When changing a setting in the web user interface and clicking Save, I get an error: Request failed with status code 500.

afbeelding

I checked if this could be a permission issue, and granted full permissions on the Smtp4Dev folder to the DefaultAppPool, but that didn't help.

I then used Process Monitor to see what's going on, and noticed that some non existing paths are used, e.g. E:\Applications\Smtp4dev\smtp4dev\smtp4dev.

12:50:44.8293493 PM	w3wp.exe	4444	QueryOpen	E:\Applications\Smtp4dev\api	NAME NOT FOUND	
12:50:44.8294053 PM	w3wp.exe	4444	QueryOpen	E:\Applications\Smtp4dev\api\web.config	PATH NOT FOUND	
12:50:44.8294435 PM	w3wp.exe	4444	QueryOpen	E:\Applications\Smtp4dev\api\Server	PATH NOT FOUND	
12:50:44.8294645 PM	w3wp.exe	4444	QueryOpen	E:\Applications\Smtp4dev\api\Server\web.config	PATH NOT FOUND	
12:50:44.8370525 PM	w3wp.exe	4444	NotifyChangeDirectory	E:\Applications\Smtp4dev		Filter: FILE_NOTIFY_CHANGE_FILE_NAME, FILE_NOTIFY_CHANGE_DIR_NAME, FILE_NOTIFY_CHANGE_ATTRIBUTES, FILE_NOTIFY_CHANGE_SIZE, FILE_NOTIFY_CHANGE_LAST_WRITE, FILE_NOTIFY_CHANGE_CREATION, FILE_NOTIFY_CHANGE_EA, FILE_NOTIFY_CHANGE_SECURITY, FILE_NOTIFY_CHANGE_STREAM_NAME, FILE_NOTIFY_CHANGE_STREAM_SIZE, FILE_NOTIFY_CHANGE_STREAM_WRITE
12:50:44.8370693 PM	Rnwood.Smtp4dev.exe	5504	CreateFile	E:\Applications\Smtp4dev\smtp4dev\smtp4dev	NAME NOT FOUND	Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open No Recall, Attributes: D, ShareMode: Read, Write, AllocationSize: n/a
12:50:44.8371252 PM	Rnwood.Smtp4dev.exe	5504	CreateFile	E:\Applications\Smtp4dev\smtp4dev\smtp4dev\appsettings.json	PATH NOT FOUND	Desired Access: Generic Write, Read Attributes, Disposition: OverwriteIf, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, AllocationSize: 0
12:50:44.8371486 PM	w3wp.exe	4444	QueryOpen	E:\Applications\Smtp4dev\app_offline.htm	NAME NOT FOUND	

The logfile:
stdout_20210917104351_4444.log

Smtp4Dev version is win-x64-3.1.3.2
Windows is Server 2012

@jafin
Copy link
Contributor

jafin commented Sep 17, 2021

The log mentions System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\Applications\Smtp4dev\smtp4dev\smtp4dev\appsettings.json does that file exist?

@bveldkamp
Copy link
Author

bveldkamp commented Sep 17, 2021

@jafin No, Smtp4dev is installed in E:\Applications\Smtp4dev. The subfolder smtp4dev\smtp4dev does not exist, I have no idea where that comes from.

FWIW E:\Applications\Smtp4dev\appsettings.json does exist

@jafin
Copy link
Contributor

jafin commented Sep 18, 2021

@bveldkamp can you run the application via the exe ok and perform the save function? (outside of a hosted app pool?)

@bveldkamp
Copy link
Author

@jafin Yes, running the app standalone works, and saves settings to %APPDATA%\smtp4dev\appsettings.json

@jafin
Copy link
Contributor

jafin commented Sep 21, 2021

@bveldkamp I setup the app under IIS on Windows 10. I can see the same error you reported when saving settings.
This is not ideal, but if you create a subfolder smtp4dev\smtp4dev in the smtp4dev installation then it will allow the settings to save, if the Apppool account has permission to write to that folder.

For example, I copied the distribution to c:\iis\smtp4dev
I then create the folder c:\iis\smtp4dev\smtp4dev\smtp4dev
In the app, Save settings, it should write an appsettings.json to c:\iis\smtp4dev\smtp4dev\smtp4dev\appsettings.json
The IIS AppPool executing the website must have write permission to that folder.

I think this can be tidied up a bit in the app, there should be no need for the app to have this path created.

@bveldkamp
Copy link
Author

@jafin Thanks, that is OK as a workaround. I hope this can be fixed sometime though.

jafin added a commit to jafin/smtp4dev that referenced this issue Sep 26, 2021
…(<dir>/smtp4dev/smtp4dev/appsettings.json) This changes the path under IIS to <dir>/smtp4dev/appsettings.json. This is a shipped path. Resolves rnwood#898
rnwood pushed a commit that referenced this issue Sep 26, 2021
…(<dir>/smtp4dev/smtp4dev/appsettings.json) This changes the path under IIS to <dir>/smtp4dev/appsettings.json. This is a shipped path. Resolves #898 (#910)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants