If you are running this from another project then you'll be using the config from that folder which wont have a config file hence the error that it cannot be created.
You may want to use server.mappath or something like that to get to the web folders config file.