Resolved. .Applications.Add() method requires slash at beginning:
site.Applications.Add("\\src\services\myservice", "/myservice");
Question
I have a problem where adding Application to IIS Site with network physical path.
In code:
using Microsoft.Web.Administration;
...
ServerManager serverManager = new ServerManager();
var site = serverManager.Sites.Where(i => i.Name == "services").SingleOrDefault();
site.Applications.Add("\\src\services\myservice", "myservice"); //exception
My application throws an exception "Invalid application path". I try to create a Virtual Directory, but I already catch this exception. Application pool and my program have a permissions to this network folder. How to fix this problem?
No correct solution
OTHER TIPS
Resolved. .Applications.Add() method requires slash at beginning:
site.Applications.Add("\\src\services\myservice", "/myservice");