Tag Archives: c#

deploying asp.net mvc

the goal of every application is to get deployed on a server or another computer. sometime its really easy and logic to do so and sometimes its easy and logic, but you really mess up…

first of all asp.net mvc needs some dlls in the GAC… but normally installing stuff on servers is not really the good way… goal should be, to install as less as possible, or at least good controlable… and in my case, its a windows server… so controlable is not really a word to describe it… but on the other hand, im just a developer and not a server admin… so i might be wrong…

to avoid installing stuff in the GAC for asp.net mvc, just simply add the dlls to the bin folder and voila… every thing is good 🙂 you need to add following dlls:

  • Microsoft.Web.Infrastructure
  • System.Web.Helpers
  • System.Web.Mvc
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Deployment
  • System.Web.WebPages.Razor

or just read http://drew-prog.blogspot.com/2011/01/how-to-deploy-aspnet-mvc-3-app-to-web.html

and it works… or lets say here ends the easy and logic part 🙂

in my case, it didnt work… why? we use nant to deploy out application and we do not publish the .config files. makes sence, because the web.config contains server information and is unique for a server… but the views folder has an own, mvc-based web.config and a packages.config, which might be used as well… so i or lets say the deploy script messed up 😛

asp.net mvc

at work i needed to create a new web frontend… and actually i am really disapointed with microsoft web framework asp.net… for me it is too random… ok i dont know how to do it correctly, but i am really confused with the 32452390918745 events, which will be called every postback (postback? never thought in java, that there might be different types of postback… and handlers…)… but yeah… did some application with asp.net and they all work… and are running… i think… 🙂

new project. new technology: asp.net mvc. i like it… the concept is as stated in the name: mvc… and actually i think it is really good implemented and totally included into visual studio… simple create a controller… based on it create views and of course use the model… the where is my model thing is for me not yet 100% clear… when using a external project/dll… is the dll the model? or is the dll only the functionality for the controller to fill the model? or is the model a wrapper around the dll? currently using a bit of all possibilities… works, but fareaway from perfect…

c# unit testing: code coverage

ok unit testing in vs2010 was really easy… setting up code coverage analysis is simple too…

  1. edit the local.testsettings
  2. goto Data and Diagnostics
  3. enable Code Coverage
  4. configure it
  5. add the dll
  6. tada: done

just run the tests again and look at the code coverage…

c# unit testing

I thought, after using nant, it is time to use unittests in my c# code. The main idea was to try out test driven implementation methods for my next, small project.

Ok asked google about how to implement unit testing in my maschine… how was it called? NUnit? ok found something different and im really proud on microsoft… a unit testing framework is include to Visual Studio 2010… and its really easy…

Crossread the following link and understood it: http://www.dreamincode.net/forums/topic/108976-c%23-unit-testing-basics/

c# webservice

creating a webservice in c# is easy… really… just click around in the visual studio and voila a new webservice 🙂 ok its a bit spooky, but who cares…

consuming a webservice is kinda spooky too… i tried to attach a webservice on a remote server and in my program to call the service i dont have a app.config… ok thats not true, but i wanted to call the service witout changing it all the time… therefore:

BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

EndpointAddress remoteAddress = new EndpointAddress(<address>);

WebService1SoapClient ws= new WebService1SoapClient (binding, remoteAddress);

ws.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;