Generating controllers in a ASP.NET Web API Self-Host application - visual-studio-2012

ASP.NET Web API project template in Visual Studio 2012 is a specialized MVC4 project and after creating an instance of such a project, right clicking on the "Controllers" folder shows you "Add >> Controller" menu item which triggers the controller generator. (scaffolding)
On the other hand, it is also possible to host an ASP.NET Web API server in a console application, which is called in the documentation a Self-Host application.
http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api
My question is:
How can I use the "Controller Scaffolding" if I am developing a self hosting console application?

Scaffolding is still supported via the package manager console e.g. here.
But the MVC specific "Add Controller" dialog is indeed reserved for MVC project files.
You can however, force your self host project to include this dialog.
This can be achieved by adding a line into the project file to "trick" visual studio into thinking your self host app is a MVC app. See this question for details "Add Controller" / "Add View" in a hybrid MVC/WebForms ASP.NET application
If you:
Create a Controllers folder under your project root
Right mouse button your self host project file and "Unload Project"
Right mouse button your self host project file "Edit "
Under the Xml > Project -> PropertyGroup Add the node shown under the steps
Save
Right mouse button your self host project file click reload project
<ProjectTypeGuids>
{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
Once you have done this you can start playing around with TT files (scaffolds) to make them more useful/specific to self hosting http://www.hanselman.com/blog/ModifyingTheDefaultCodeGenerationscaffoldingTemplatesInASPNETMVC.aspx

I don't think this is currently possible. This scaffolding support is specific to MVC 4 projects currently.

Related

acumatica project customizations project ID missing on localhost instance

I have a local instance of Acumatica 2018 R2 that I am using for development and when I try to edit a Customization Project it is not pulling in the specific project and ID.
Local instance of the Custom Project editor
Where it says "Project" in the top left, it should say "Test5".
Here is how the editor should look:
Production Instance Custom Project Editor
I believe that I've configured my IIS setting correctly but I can't get it to perform correctly.
I've seen that happen before. It appears to be an Ajax glitch. When the customization project editor opens it displays Project as a placeholder first. Then an Ajax call fetch the proper project name to replace the template placeholder text.
There isn't much to do to resolve this issue. I suggest using a different web browser (Chrome seems to handle Ajax more reliably) and possibly issuing an IISReset command on the web server or if you don't have access to server a restart application from the apply updates page.

newbie --> How to deploy my jsr 168 portlet inside liferay

Three simple questions...
Question 1.
I have a JSR168 portlet that is deployed over IBM Websphere Portal server at my company. I was using a version of IBM Portal server for my development but strictly speaking I don't think I am allowed to use these at my company. So now my plan is to do my development and testing on my local machine using liferay and then deploy to IBM Portal Server.
From what I have read about liferay since it supports jsr168 I should not have any problems. Is this correct?
Question 2.
I've just finished installing the liferay 6.2-5 stack on my mac from the Bitnami site. It is running but I am having troubles understanding how I can deploy my first portlet (which by the way works under IBM Portal Server).
After logging in I go to Admin> Control Panel> Apps> App Manager. I then hit Install and select my war file and then put in a context root. But I keep getting an error message "Please enter a valid url".
What is the problem here?
Question 3.
After the Portlet has been installed how can I see it in liferay?
thanks in advance
for 1: correct, Liferay supports JSR-168
for 2: You can either drop your WAR file in Liferay's "deploy" folder, which will cause Liferay to deploy it from there. If it disappears from that folder within a few seconds, it has been deployed.
The administrative UI allows you to do a similar thing through the Web UI - you can either upload your plugin or point to a URL where Liferay can download it: Don't mix it up with Websphere's admin UI where you give the context name for an uploaded application. In Liferay you'll either have to use the upload OR the URL. The context name is derived from the name of the WAR file.
for 3: You'll find your plugin when you choose the "Add" button - login as Administrator and you'll find a "+" labelled button on the left side of the screen. Choose "Application" and look for your portlet (you can filter the list). If you include some Liferay-specific deployment descriptors (look up WEB-INF/liferay-display.xml) you can also influence which section/headline it appears under.

Publish Web wizard does not appear per microsoft's instructions

According to this page, "right-click the project and select Publish (or Publish Web Site for web site projects) to open the Publish Web wizard". What then comes up looks nothing like what is shown on that page, instead I get this:
which looks nothing like the "Publish Web wizard" described on the MS page. I have tried many of the options on that page, none of them lead to asking me to import my host's "publish profile".
Is there another way I can get to the Publish Web wizard so I can import my host's "publish profile"?
Try install this update: http://msdn.microsoft.com/library/jj161045
I had the same problem. This worked for me.
AFAIK, the Publish Web wizard (just like the one that is shown in the link you provided) is only available for Web application projects, not for Web Site projects, whereas the screenshot in your original question is the tool provided in Visual Studio to publish web sites.
In my case, I found it useful to convert the web site project to a web application project following the suggestions given here and explained in detail at the LearnAsp4.com site.
Hope it helps someone :).
Hi download upgrade 5 for VS 2012 from Microsoft site and install the executable. Then VS 2012 will display the publish wizard as shown for web application.
I had an existing publish profile under App_Data that had an invalid path in the pubxml, deleting that or fixing the path fixed it for me. I found this by going to "View > Other Windows > Web Publish Activity" then either select existing or try to create a new profile from the dropdown. This then gave me an error message which "Build > Publish Web App" didn't.

visual studio web development using IIS specific URI

I'm using Visual Studio 2010 with Web Development Tools. I have an ASP.net Web-Application and under project-settings using "Local IIS webserver" with project URL "http://localhost/test.mywebapp.com". This ends up in IIS under "Default WebSite".
Now when I run my webproject from within visual studio, it opens a browser with the uri like "http://localhost/test.mywebapp.com/index.aspx" - so far so good.
Now I need to access this page from another application. As a simple test, let's say I want to open a tab "test.mywebapp.com/index.aspx" in my browser and make it reach the the page runing in the debugger.
I added an entry "127.0.0.1 test.mywebapp.com" to the win32/etc/hosts file. Now I open the URI in my browser, but I land at the "default" IIS7 page and not my webpage.
I tried adding a binding for the "Default Website" to test.mywebapp.com", but then it opens under test.mywebapp.com/test.mywebapp.com/index.html - also not correct...
I'm obviously missing some step mapping my URI to the correct WebSite, but I don't know how this is called or what to google for...
Any ideas?

SharePoint 2010 VS development: Intellisense for ASPX files

I'm using Visual Studio 2010 to develop a SharePoint Server 2010 solution. Part of this includes custom Page Layouts, but when editing them, intellisense is completely broken, since Visual Studio doesn't appear to know how to handle them. Here's what I've done:
Created a new blank solution
Right-clicked on the solution and created a new "Empty SharePoint Project"
Right-clicked on the project and created a new "Module"
Renamed sample.txt to MyPageLayout.aspx or created a new ASPX Web Form
At this point, intellisense for the new Page Layout is broken. It gets even worse with tools like ReSharper installed. Also, things like "Format Document" will break the Page Layout (by for example changing asp:Content to asp:content)
What I've tried to get intellisense working:
Added a Web.config from a standard Web Application Project to the root of the SharePoint Project - made no difference.
Added the ProjectGuid for a Web Application Project to the SharePoint project file - broke the project.
Is there any way to get intellisense, and the rest of the support Visual Studio can offer for Web Forms, available when developing SharePoint 2010 Page Layouts?
I have followed your post to some extent.
Using VS2010 (On an x64 machine)
Create a blank SharePoint solution. (this properly combines your #1 & #2)
Add a module (in SharePoint a module is like a folder or resource container)
added a new class to the module (intellisense present)
Added a new webpart to the module (intellisense present)
added a user control to the project designer works and (intellisense present)
I believe that you should consider creating true server or visual web parts. This will have a harder learning curve but will pay with dividends in the future. You will be able to package and deploy your solution again or to another server/farm. Aspx pages can be added and manipulated by the dreaded SharePoint designer. In 2010 the theory is that those designer mods can be packaged and deployed.
I work in this environment every day and the best advice I can give is to embrace the SP object model and do 'it' the sharepoint way. Don't try to force SP to be something its not. :)
This is probably not the solution you are looking for but it's the best thing I found for SharePoint development.
In your solution, create 2 projects :
1 SharePoint Project (empty or not)
1 ASP.NET web application project
Develop all your UI (aspx pages, ascx controls, etc.) in your ASP.NET project and create post-build steps that will copy the pages and controls to the appropriate folders in your SharePoint solution.
That way, you will benefit from all the features of web development in visual studio and it will be very easy to deploy as well. It is a bit of a time investment at first, but it is well worth it if you have any considerable amount of logic to implement in your aspx pages.
This blog post documents what you need to do.
you can add an intellsense to pagelayouts by closing the page and simply reopen it from
file->openfile->your file page layout path
Or you can directly "Right Click" on the file you want to open from the Solution explorer and then select "Open" : you'll get the Intellisense !

Resources