开发者

WCF: multiple services in one project hosted on IIS, but different permissions?

I have an existing app and need to expose parts of it to the outside world, with different services for different clients.

To be precise, it is already running with one WCF service and now I need to add a second service, totally unrelated to the first one, to be consumed by a totally different client.

When I created the existing service, I added a WCF Service Project to our existing solution, and then I created a new "WCF Service" and edited that.

So, in Visual Studio, the f开发者_JAVA百科older layout looks like that:

\MyServiceProject\IMyFirstService.cs
\MyServiceProject\MyFirstService.cs
\MyServiceProject\MyFirstService.csproj
\MyServiceProject\MyFirstService.svc
\MyServiceProject\Web.config

We have a build script that compiles stuff and copies files, and then the published folder on IIS looks like that:

\MyFirstService\bin\MyServiceProject.dll
\MyFirstService\MyFirstService.svc
\MyFirstService\Web.config

(if I recall it correctly, it only worked when the DLL was in a subfolder named "bin", hence the copying in the build script)

Now I want to add another .svc file.

I would prefer to avoid having to create a second WCF Service project...I would like to add the new service to the existing project instead.

BUT: The second service needs to have different permissions than the first one (restricted outside access, but to different clients...).

According to our admin, I have to put the second service in a second folder so we can give it different permissions.

So the deployed services would have to look like this:

\MyFirstService\MyFirstService.svc
\MySecondService\MySecondService.svc

But that would also mean that the other files would have to be duplicated:

\MyFirstService\bin\MyServiceProject.dll
\MyFirstService\Web.config
\MySecondService\bin\MyServiceProject.dll
\MySecondService\Web.config

I don't care about duplicating MyServiceProject.dll, but what about the Web.config?

There's only one in Visual Studio, and if I want to run the services in debug mode, I have to add both services to it.

Or can I somehow split the web.config, so that it works in Visual Studio (when both services are in the same folder) and deployed on IIS (where each service has its own folder)?

Any idea how to solve this?

Or am I doing something completely wrong? This WCF stuff is all new to me, and everything I did so far was hacked together with help from Google...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜