While building a Vb.net Windows service the references to a couple of other projects within the same solution seemed lost. While the references where still there, in the project properties the framework target was set to .Net Framwork 4 Client Profile. Change it to .Net Framwork 4 and you’ll get your references back !
I’ve been struggling for a while this morning, trying to use one of the most popular MVC tools features: the ability to generate a controller with the CRUD (Create, Read, Update, Delete) actions over a model. The generator will create the different views as well. Or better.. it should =) Everything works smoothly when you got one project only within your solution , including models, dal etc.
While if your app is layered into several projects, here’s a couple of things you should keep in mind in order to get the scaffholding working:
- The project containing the model you want to scaffhold must include the configuration file with the connection string for your context.
- The web project (from where you will create the scaffholded controller) not only it must have the config file with the connection string. The connectionstrings can’t be in separated config files (configSources)! Or you will end up getting this : The type initializer for ‘System.Data.Entity.Internal.AppConfig’ threw an exception.
Last thing to keep in mind is to expose the DbSets instead of IDbSets in your DbContext or the code generator will not work. Happy scaffholding to everyone!
If you got one, you can implement the below in your service layer. The original code is in Vb.Net, like the project I am working on…sorry . Btw I’ve converted with one of the several tools online.
Just run this:
While mocking a VB method I was getting the following error :
‘Public Function Setup(expression As System.Linq.Expressions.Expression(Of System.Action(Of EmailSender.IMailManager))) As Moq.Language.Flow.ISetup(Of EmailSender.IMailManager)’: Expression does not produce a value
Here’s the moq setup :
mailManager.Setup(Function(x) x.SendEmail(It.IsAny(Of MailManagerSettings))).Verifiable()
Because the SendEmail method is a Sub instead of a Function.
Let's replace the Setup target Function with a Sub and this will complile. (Sub lambda support is quite new though.)
I’ve just installed IIS 7.5 on a machine with Windows 7. Of course the website I deployed didn’t work on the first attempt, here’s a few steps to fix the missing (or wrong) settings on the webserver. Before starting ensure the url you enter on the browser points to the deployed website. Main things to check :
- The host file under C:\Windows\System32\drivers\etc should have an entry for the website deployed.
- Assign the same url to the host name of your website under IIS.
* Ensure you enter the site url including the port, es http://www.dev.mywebsite.com:8099
Once all the correct urls are been set on both iis and the host file, try access the site.
The same website working perfectly within the Visual Studio webserver, now on IIS, returns this error when trying to browse it:
HTTP Error 500.19 – Internal Server Error
Description: The requested page cannot be accessed because the related configuration data for the page is invalid.
Odd because the web.config haven’t changed. To fix it edit the applicationHost.config in the c:\Windows\system32\inetsrv\config folder by changing the following key values:
- <section name="handlers" overrideModeDefault="Deny" />
- <section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
The equivalent of a Linq.Where() in JQuery:
Next step will be using linqjs