0

I have a ASP.NET web api project, the api has lot of dependencies to other dlls so we have placed all the dlls in a specific folder. If I point output path of the web api to that output directory and execute in IISExpress it gives following error

Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.

If we see file location of the error it is still pointing to WebAPI_SourceCode_Directory\web.config and not my output folder. But output folder has web.config file. How can I make the web app to run from output folder using IISExpress

Baala Srinivas K
  • 339
  • 1
  • 3
  • 14

2 Answers2

0

It is not recommended to change the output directory of an asp.net application due to IIS security restrictions.

However you can still hack your way through it by changing config files appropriately, see here

As per MSDN article, when you compile a Web application the compiled code is placed in the Temporary ASP.NET Files folder

To find this Temporary ASP.NET Files folder check my post here

Clint
  • 6,011
  • 1
  • 21
  • 28
  • I tried probing it was not working, Can we use probing only if my dlls are inside subfolder of bin? – Baala Srinivas K Feb 14 '20 at 08:21
  • after probing did you also add relevant assemblies under `` ? – Clint Feb 14 '20 at 11:15
  • No, I did not specify that. But i got this info from Microsoft docs page "The directories specified in privatePath must be subdirectories of the application base directory." Url: https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/specify-assembly-location does this mean the dlls cannot be outside subfolder? – Baala Srinivas K Feb 17 '20 at 05:50
  • @BaalaSrinivasK, yes that's right. It seems like you also need to add the relevant assemblies after probing step as you saw on the other *SO* post – Clint Feb 17 '20 at 05:57
  • @BaalaSrinivasK , just following up , if you think you've found this answer helped you, it will be great if you can mark as resolved, if not, you can let me know if there is any thing I can add to improve it :) – Clint Feb 29 '20 at 08:00
  • Hi Clint, I tried it out but it did not work out. For now I am duplicating the dlls and working with it – Baala Srinivas K Mar 03 '20 at 07:07
0

do not use IIS express for development, use a proper IIS instead. This way you will iron out any production issues from the beginning.

Whether your API has a lot of dll dependencies or not, it makes no difference. The API needs to know where to get them from and I wouldn't change the default behavior. They will be in the bin folder like all the other dependencies when you build the project.

To deploy the API even in a local environment, use the Publish method to a local folder, then build an IIS application pointing to that folder.

That's all you need to do, so why complicate things? You can still publish in debug mode, you can still connect your Visual studio to it and debug it properly. There is literally zero need to fight the default way of doing things.

Andrei Dragotoniu
  • 6,155
  • 3
  • 18
  • 32