Trace map attached to a finite homomorphism of noetherian rings Let $f:A\rightarrow B$ be a homomorphism of noetherian rings which
makes $B$ into a finite $A$-module.  Under what conditions on $f$, $A$,
$B$ can one associate to this map a canonical "trace map"
$$\mathrm{Tr}_f:B\rightarrow A,$$ 
i.e. a homomorphism of $A$-modules $B\rightarrow A$ which is compatible with base change (perhaps with restrictions on the kind of allowable base changes), localization, and
which recovers the "usual" thing when $B$ is free over $A$ (i.e.
$\mathrm{Tr}_f(b) =$ the trace of the $A$-linear endomorphism given by
multiplication by $b$ on the finite $A$-module $B$)?
Here are my thoughts so far:
1) If $f$ is flat, one always has $\mathrm{Tr}_f$.  Just work locally,
using that finite flat over a noetherian local ring is free.
2) More generally, if $f$ is of finite Tor-dimension, I can construct
$\mathrm{Tr}_f$ by taking a finite projective resolution
$$0\rightarrow P_n\rightarrow \cdots\rightarrow P_0\rightarrow B\rightarrow 0$$
of $B$ as an $A$-module: lift multiplication by $b$ on $B$ to a map of complexes
$b:P_{\bullet}\rightarrow P_{\bullet}$ and define
$$\mathrm{Tr}_f(b) := \sum_i (-1)^i \mathrm{Tr}_i(b)$$
where $\mathrm{Tr}_i(b)$ is the trace of the (lift of the)
endomorphism $b$ of $B$ to $P_i$.
One chekcs this is independent of the choice of projective resolution.
It commutes with "tor-independent" base change (sometimes called
"cohomologically transverse" base change).
3) If $A$ and $B$ are normal, I can construct $\mathrm{Tr}_f$ as follows: the localization of $f$ at any height-1 prime ideal is automatically flat by Matsumura 23.1 as the corresponding localizations of $A$ and $B$ are regular and the dimensions work out (the fiber ring is 0-dimensional as $f$ is finite).  Thus, one has a canonical trace map on each localization, and since $A$ and $B$ are normal, they are the intersections of these localizations so we win.
4) If $A$ and $B$ are only assumed reduced, one can look at the injections $A\rightarrow A'$
and $B\rightarrow B'$ with $A'$ and $B'$ the normalizations of $A$ and $B$ in their total rings of fractions.  Let $f':A'\rightarrow B'$ be the corresponding map.  By 3), we get a trace map
for $f'$ and the whole problem of constructing 
the trace map for $f$
comes down to showing that $\mathrm{Tr}_{f'}$ carries $B$ into $A$.  Letting $C_A:=\mathrm{ann}_{A'}(A'/A)$
be the conductor ideal (with $C_B$ defined similarly), I think that a necessary condition for 
$\mathrm{Tr}_{f'}(B)$ to be contained in $A$ is
$$f'(C_A) \supseteq C_B.$$
Is this condition sufficient?  As an example of how things can go wrong if this condition is 
violated, consider the finite map between reduced $k$-algebras ($k$ a field)
$$k[x,y]/(xy) \rightarrow k[x]$$ 
given by sending $y$ to 0.  The normalization of $k[x,y]/(xy)$ is the product $k[x]\times k[y]$
and the trace map attached to $f':k[x]\times k[y]\rightarrow k[x]$ sends $b\in k[x]$ to 
$(b,0)$.  But $(b,0)\in k[x]\times k[y]$ lies in the image of $k[x,y]/(xy)\rightarrow k[x]\times k[y]$
if and only if $b(0)=0$.  It follows that the trace map on normalizations doesn't restrict to a trace map on the original rings.
I'd be happy to assume that $A$ and $B$ are flat $R$-algebras, for a regular local ring $R$, and that $f:A\rightarrow B$ is an $R$-algebra homomorphism.  I'd also be happy to assume that $A$, $B$, and $f$ are local, with $A$ and $B$ reduced complete intersections over $R$.  I'm wondering if there is a framework for trace maps in this context that is general enough to handle the different constructions given in 1) -- 4) above.
 A: This is really a response to Karl's beautiful example; I'm posting it as an "answer" only because there isn't enough room to leave it as a comment.
The condition on conductor ideals is one that I had come across by thinking about the dual picture.
Namely, let $f:Y\rightarrow X$ be a finite map of 1-dimensional proper and reduced schemes over an algebraically closed field $k$.  Then $Y$ and $X$ are Cohen-Macaulay by Serre's criterion, so the machinery of Grothendieck duality applies.  In particular, the sheaves 
$f_*O_Y$ and $f_*\omega_Y$ are dual via the duality functor $\mathcal{H}om(\cdot,\omega_X)$, as are 
$O_X$ and $\omega_X$.  Here, $\omega_X$ and $\omega_Y$ are the ralative dualizing sheaves of
$X$ and $Y$, respectively.  Thus, the existence of a trace morphism $f_*O_Y\rightarrow O_X$
is equivalent by duality to the existence of a pullback map on dualizing sheaves $\omega_X\rightarrow f_*\omega_Y$.  
In the reduced case which we are in, one has Rosenlicht's explicit description of the dualizing sheaf: for any open $V$ in $X$, the $O_X(V)$-module $\omega_X(V)$ is exactly the set of
meromorphic differentials $\eta$ on the normalization $\pi:X'\rightarrow X$ with the property that $$\sum_{x'\in \pi^{-1}(x)} res_{x'}(s\eta)=0$$
for all $x\in V(k)$ and all $s\in O_{X,x}$.  
It is not difficult to prove that if $C$ is the conductor ideal of $X'\rightarrow X$ 
(which is a coherent ideal sheaf on $X'$ supported at preimages of non-smooth points in $X$), 
then one has inclusions 
$$\pi_*\Omega^1_{X'} \subseteq \omega_X \subseteq \pi_*\Omega^1_{X'}(C).$$
Since $X'$ and $Y'$ are smooth, so one has a pullback map on $\Omega^1$'s, our question
about a pullback map on dualizing sheaves boils down the following concrete question:
 
   When does the pullback map on meromorphic differentials $\Omega^1_{k(X')}\rightarrow \pi_*\Omega^1_{k(Y')}$ carry the subsheaf $\omega_X$ into $\pi_*\omega_Y$?

By looking at the above inclusions, I was led to conjecture the necessity of conductor ideal containment as in my original post.  As Karl's example shows, this containment is not sufficient.
Here is Karl's example re-worked on the dual side:
Set $B:=k[x,y]/(xy)$ and $A:=k[u,v]/(uv)$ and let $f:A\rightarrow B$ be the $k$-algebra map
taking $u$ to $x^2$ and $v$ to $y$.  Writing $B'$ and $A'$ for the normalizations, we have
$B'$ and $A'$ as in Karl's example, and the conductor ideals are $(x,y)$ and $(u,v)$.
Now the pullback map on meromorphic differentials on $A'$ is just
$$(f(u)du,g(v)dv)\mapsto (2xf(x^2)dx,g(y)dy).$$
The condition of being a section of $\omega_A$ is exactly 
$$res_0(f(u)du)+res_0(g(v)dv)=0,$$
and similarly for being a section of $\omega_B$.  But now we notice that
$$res_0(2xf(x^2)dx)+res_0(g(y)dy) = 2 res_0(f(u)du) + res_0(g(v)dv) = res_0(f(u)du)$$
if $(f(u)du,g(v)dv)$ is a section of $\omega_A$.  Thus, as soon as $f$ is not
holomorphic (i.e. has nonzero residue) the pullback of the section 
$(f(u)du,g(v)dv)$, as a meromorphic differential on $B'$, will NOT lie in the subsheaf $\omega_B$.
Clearly what goes wrong is that the ramification indices of the map $f:A'\rightarrow B'$ 
over the two preimages of the nonsmooth point are NOT equal.  With this in mind, I propose the following addendum to my original number 4):

  In the notation of 4) above and of Karl's post, assume that $f'(C_A)=C_B^e$
for some positive integer $e$.  Then the trace map $B'\rightarrow A'$ carries $B$
into $A$.

Certainly this rules out Karl's example.  I think another way of stating the condition is that the map $f':Spec(B')\rightarrow Spec(A')$ should be "equi-ramified" over the nonsmooth locus of $Spec(A)$, i.e. that the ramification indices of $f'$ over all $x'\in Spec(A')$ which map to the same nonsmooth point in $Spec(A)$ are all equal.
Is this the right condition?
A: I had pretty much forgotten, but Craig Huneke and I needed to know something about traces a few years ago, and couldn't find a good reference, so we put some facts as an appendix in this paper.  Our context forced us to define the trace of a module, rather than an algebra, but of course you can just ignore the algebra structure on $B$.  
The setup for us was this: Let $R$ be a Noetherian ring and $M$ a finitely generated torsion-free $R$-module.   The trace of $M$ is an $R$-homomorphism $\mathrm{End}_R(M) \to R$, which matches the one you're describing if $M$ is free.  It's obtained as follows: let $\alpha : Hom(M,R)\otimes_R M \rightarrow End(M)$ be the natural homomorphism defined by $\alpha(f\otimes x)(y) = f(y) \cdot x$.  If the dual of $\alpha$, that is $\alpha^*$, is an isomorphism from $Hom(End_R(M),R)$ to $End_R(Hom(M,R))$, then the trace of $M$ is $(\alpha*)^{-1}$ of the identity on $Hom(M,R)$.  We say then that $M$ "has a trace."
[Exercise: if $M$ has $R$-torsion, then the trace of $M$ is the same as the trace of $M/\mathrm{torsion}$, so defining the trace in the torsion-free situation is enough.]
Now, here's the sufficient condition we needed (Prop A.2): if $R$ satisfies $(S_2)$ and $M_p$ is free over $R_p$ for all height-one primes $p$, then $M$ has a trace.
This is a jazzed-up version of your (3), and maybe helps with (4).
(Parenthetically, we also needed to know when the trace was surjective, which is where the characteristic comes in, and I conflated it with the trace existing in one of my comments earlier.)
A: With regards to 4), I think the condition you described involving the conductor ($f'(C_A) \subseteq (C_B)$) is not sufficient (although I do agree that it is necessary).
For the trace map at the level of the total field of fractions, I just applied trace to each field extension separately and added the results.  If this is not the right thing to do here, let me know (the extension of total fields of fractions need not turn an extended ring into a free modules, so I don't see what else to do).
Consider the following example:
I'll define the normal rings first.
$$A' = k[x^2] \oplus k[y], B' = k[x] \oplus k[y].$$
I'll use the obvious inclusion $A' \subseteq B'$.   Set $A$ to be the subring of $A'$ made up of all pairs $(s,t)$ such that the constant term of $s$ and the constant term of $t$ agree (for example, $(3 + x^2 + x^4, 3 + y)$ would be in $A$).  Set $B$ to be the subring of $B'$ made up of all pairs $(u,v)$ such that constant terms of $u$ and $v$ agree.  Clearly we have an inclusion $A \subseteq B$.  
In other words, $\text{Spec} A$ is the node obtained by gluing the two components of $\text{Spec} A'$ together at their respective origins and $\text{Spec} B$ is the same (but with gluing the components of $\text{Spec} B'$ together at the origin).  
The conductor of $A$ in $A'$ is the ideal made up of all pairs $(s, t)$ with zero constant term (it corresponds to the origin on each ring).  Likewise the conductor of $B$ in $B'$ is the ideal made up of all pairs $(u, v)$ with no constant term.  
Clearly the trace map sends the conductor to the conductor but $Tr(B) \not\subset A$ because $Tr(1,1) = (2,1) \notin A$.  
A: The trace ideal of $f$ is defined under very general condition: see Appendix of Auslander-Goldman paper:
"Maximal order",TAMS (97), No1, 1960 (p1-24) 
(See page 20) It is basically what Graham described above. I don't think you need any condition to define trace in this sense (even work over non-commutative rings). However, for the ideal to be interesting, you probably need some sort of non-degenerate conditions like in Graham-Craig paper. 
EDIT: Of course, you need a map $B \to A$, so things are more subtle then the references. Here is a summary of what I can think of: Let $(-)^* =Hom_A(-,A)$. Of course, one can always embed $B \to Hom_A(B,B)$. 
Now there is a natural map $Hom_A(B,B) \to Hom_A(B,B)^{**}$. 
Under mild conditions, the map $(B\otimes B^*)^{**} \to Hom_A(B,B)^{**}$ (induced by $B\otimes B^* \to Hom(B,B)$ is an isomorphism. (1) 
But the map $B\otimes B^* \to A$ by evaluation induces a map:  $(B\otimes B^*)^{**} \to A^{**}=A$.
So the critical issue now is to check (1), i.e when 
$(B\otimes B^*)^{**} \to Hom_A(B,B)^{**}$ 
is isomorphic. 
Since both modules are reflexive, we only need to check that the map is an isomorphism in codimension
1. Of course, if $B$ is free in codimension 1, then it is true, but I think a much 
weaker condition, like $B$ having constant rank on the minimal primes of A would suffice.
EDIT: I just thought about it a little more. So far, we have shown that if $A$ is normal and $B$ is $A$-free locally in codimension $1$, then one can construct a map. Unfortunately, in dimension $1$ which seems to be your main concern, this implies flatness. Actullay, here the situation seems to be quite subtle. The map in (1) is quite often injective, but I think I can prove:
Proposition: If $A$ is dimension $1$, Gorenstein and $B$ is torsion-free as $A$-module, then the map (1) is an isomorphism implies that $A$ is locally a direct summand of $B$. 
So I am now convinced that the situation is interesting in dimension 1! May be some other people can help? 
