I noticed that when I added a Controller Class that it put a load of xml and dll files into a Packages directory in five different folders.
To deploy this functionality to my existing asp.net website I need to (1) copy the Controller and Product classes to the root of my website, (2) put the routing code in my global.asax file.
Where do I copy all of those files in the Packages directory? Can I just copy the whole Packages directory structure into my bin directory?
How do you curretly build your Web Forms applications? The process should be the same. Your bin folder should contain all of your assemblies, so everything from packages should be in the proper place, and you shouldn't need the packages folder. Web API shouldn't
generate any content, so your controllers should have compiled into your project assembly. Check your bin folder to make sure that the referenced assemblies from packages are in there, but you should be able to deploy just as you did before.
If you are not using separate, code-behind files for your WebForms and instead using <script> blocks, then this might be different for you.
Are you saying that I should take the 6 directories currently under the "packages" directory and put that entire directory structure under my /bin folder at my asp.net website (It's a website, not a Web Forms Application)? The only Script file I have is
global.asax.
BTW, is there any documentation anywhere that tells what this load of .dlls and .xmls stuff is?
The packages folder is created and maintained by the
NuGet package manager. I've never used the ASP.NET Website template, so I don't know how you would deploy that. Generally speaking, an ASP.NET web application must be compiled. When compiled, it creates two new folders, bin and obj, that contain the assemblies
necessary to run the application. Some assemblies may be stored in the GAC, in which case they would not appear in the bin folder. You could then copy the project as is or use the
WebDeploy tool in Visual Studio to publish the web application for hosting in IIS.
As to IIS hosting, I've never found anything different in setting up a website that included assemblies versus a simple Web Forms application using <script> tags. If you need help setting up an IIS website, please let me know. I assume you already have this
figured out by this and other posts.
I am not positive that the packages assemblies are copied into the bin folder when the application is compiled. You could a) look and see, b) check whether the References have the CopyLocal property set, or c) just copy the packages folder along with everything
else, in its place, to the destination folder.
I have no idea how you currently deploy your web site. It doesn't sound like any of the myriad of ways I have ever heard discussed. If you could list the steps, it might help give me a bit more insight to help you. The above are pretty standard and should
do the trick. If you don't use Visual Studio, then I could see this being a little more confusing.
Don't feel bad about not knowing exactly how to deploy web api to a website. I don't think anyone at Microsoft knows how either. Deploying stuff to running websites is complex. If you look at
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/726553b3-b418-48b1-b8b4-204f5ad912cd where I documented how I finally deployed a restful WCF service you will see that it's a lot of work.
Microsoft never documents the details about what is needed to run various services on existing websites. You have to pick through documents and use trial and error to get it to work. Which package files are needed for web api functionality? Where do they
go?
They should have a "minimal web api" template in VS with only what is needed for services.
I'll probably get it worked out over the next couple of weeks.
GaryDean
Member
59 Points
88 Posts
How to deploy Web API to existing IIS7 website?
Sep 10, 2012 09:56 PM|LINK
I went through the tutorial at http://www.asp.net/web-api/overview/hosting-aspnet-web-api/using-web-api-with-aspnet-web-forms up through the add routing information section. I didn’t do the client side but instead just used a browser to test it out. It worked fine.
I noticed that when I added a Controller Class that it put a load of xml and dll files into a Packages directory in five different folders.
To deploy this functionality to my existing asp.net website I need to (1) copy the Controller and Product classes to the root of my website, (2) put the routing code in my global.asax file.
Where do I copy all of those files in the Packages directory? Can I just copy the whole Packages directory structure into my bin directory?
Thanks,
Dean
panesofglass
Member
730 Points
237 Posts
Re: How to deploy Web API to existing IIS7 website?
Sep 11, 2012 01:37 PM|LINK
How do you curretly build your Web Forms applications? The process should be the same. Your bin folder should contain all of your assemblies, so everything from packages should be in the proper place, and you shouldn't need the packages folder. Web API shouldn't generate any content, so your controllers should have compiled into your project assembly. Check your bin folder to make sure that the referenced assemblies from packages are in there, but you should be able to deploy just as you did before.
If you are not using separate, code-behind files for your WebForms and instead using <script> blocks, then this might be different for you.
GaryDean
Member
59 Points
88 Posts
Re: How to deploy Web API to existing IIS7 website?
Sep 12, 2012 12:19 AM|LINK
Are you saying that I should take the 6 directories currently under the "packages" directory and put that entire directory structure under my /bin folder at my asp.net website (It's a website, not a Web Forms Application)? The only Script file I have is global.asax.
BTW, is there any documentation anywhere that tells what this load of .dlls and .xmls stuff is?
Thanks, Dean
panesofglass
Member
730 Points
237 Posts
Re: How to deploy Web API to existing IIS7 website?
Sep 12, 2012 06:03 PM|LINK
The packages folder is created and maintained by the NuGet package manager. I've never used the ASP.NET Website template, so I don't know how you would deploy that. Generally speaking, an ASP.NET web application must be compiled. When compiled, it creates two new folders, bin and obj, that contain the assemblies necessary to run the application. Some assemblies may be stored in the GAC, in which case they would not appear in the bin folder. You could then copy the project as is or use the WebDeploy tool in Visual Studio to publish the web application for hosting in IIS.
As to IIS hosting, I've never found anything different in setting up a website that included assemblies versus a simple Web Forms application using <script> tags. If you need help setting up an IIS website, please let me know. I assume you already have this figured out by this and other posts.
I am not positive that the packages assemblies are copied into the bin folder when the application is compiled. You could a) look and see, b) check whether the References have the CopyLocal property set, or c) just copy the packages folder along with everything else, in its place, to the destination folder.
I have no idea how you currently deploy your web site. It doesn't sound like any of the myriad of ways I have ever heard discussed. If you could list the steps, it might help give me a bit more insight to help you. The above are pretty standard and should do the trick. If you don't use Visual Studio, then I could see this being a little more confusing.
GaryDean
Member
59 Points
88 Posts
Re: How to deploy Web API to existing IIS7 website?
Sep 12, 2012 08:29 PM|LINK
Don't feel bad about not knowing exactly how to deploy web api to a website. I don't think anyone at Microsoft knows how either. Deploying stuff to running websites is complex. If you look at http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/726553b3-b418-48b1-b8b4-204f5ad912cd where I documented how I finally deployed a restful WCF service you will see that it's a lot of work.
Microsoft never documents the details about what is needed to run various services on existing websites. You have to pick through documents and use trial and error to get it to work. Which package files are needed for web api functionality? Where do they go?
They should have a "minimal web api" template in VS with only what is needed for services.
I'll probably get it worked out over the next couple of weeks.
Dean