1

I tried using the SlowCheetah extension, but I can't seem to get it to work. I think i may have missed a step somewhere.

I downloaded the extension and installed it. The i created my web.config file and did the "add transform"

To test it, I was already using ELmah in my project, so I tried giving it different email address to send the error log for every config, and none in the web.config.

web.config

<elmah>
    <security allowRemoteAccess="0"/>
    <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="C:\myLogPath"/>
    <errorFilter>
      <test>
        <or>
          <equal binding="HttpStatusCode" value="404" type="Int32"/>
          <is-type binding="BaseException" type="System.FieldAccessException" />
        </or>
      </test>
    </errorFilter>
</elmah>

web.debug.config

<elmah>
    <errorMail from="error-debug@domain.tld" to="me@domain.tld" priority="High" xdt:Transform="Insert"/>
</elmah>

So, when i look at "preview transform", it seems like the result is what i want. Then I start my application (either with F5 or ctrl+F5) and purposely throw an exception on my website to trigger Elmah error reporting, but I never get any email. If I add the errorMail line in my web.config, I do get an email, so the problem is not coming from Elmah.

As I said, i feel like I may have missed a simple step in setting up the extension.

Shadowxvii
  • 1,080
  • 2
  • 12
  • 31
  • I assume your solution is set to Debug, and not something else? – Justin Pihony Aug 17 '12 at 17:49
  • You don't need SlowCheetah to transform your web.config. You can use the built in web.config transformations. – jrummell Aug 17 '12 at 17:50
  • @jrummell is correct, SlowCheetah is more for app.config, not web.config – Justin Pihony Aug 17 '12 at 17:55
  • @JustinPihony - Yes, yes it is set to debug. Anyway, i also have approximatively the same lines for deploy and release, so I should get the line anyhow, only with different "from" email addresses" – Shadowxvii Aug 17 '12 at 17:57
  • @jrummell - The thing is that the transformations are done on publish, not on build, which is the whole point of using SlowCheetah. Isn't it? – Shadowxvii Aug 17 '12 at 17:57
  • I suppose you could use it that way, but I personally don't like to introduce a 3rd party dependency if I don't have to. And I have a continuous integration server that publishes for me on commit, so I don't worry about transforming on build. – jrummell Aug 17 '12 at 18:00
  • For web projects since the web.config is in place (i.e. the one in the root is the one used at runtime) SlowCheetah cannot update that because if it changes the contents under the hood VS may behave in strange ways. If you want to enable this yourself you can follow the steps at http://stackoverflow.com/questions/3922291/use-visual-studio-web-config-transform-for-debugging. – Sayed Ibrahim Hashimi Aug 19 '12 at 00:48

2 Answers2

0

The problem you are running into isn't really with SlowCheetah, but how you are launching your web application from Visual Studio.

SlowCheetah will indeed add the necessary MSBuild Targets to your project in order to do transforms upon build, but only for things included in your project output (i.e. the \bin folder).

When you build a web application your web.config stays put, and only the assemblies are copied into your \bin folder. Visual studio fires up the WebDev server and points it to the root directory of your web application. Since your web.config hasn't been modified, it will always contain the original contents.

Josh
  • 44,706
  • 7
  • 102
  • 124
0

To my knowledge, slow-Cheetah supports config transforms for the app.config files but not web.configs on debug at present. It should put a transformed web.config file in the bin folder of your project but your project still reads from the config file in the root folder. Please have a look at a workaround at http://sedodream.com/CommentView,guid,68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb.aspx. This works for me instead of using Slow-Cheetah.

You can also request for web config transform support for Slow-Cheetah on debug at https://github.com/sayedihashimi/slow-cheetah/issues/39 They are considering adding web support on F5 to it.

user1858286
  • 164
  • 1
  • 5