This question arose while reading http://prd.aps.org/abstract/PRD/v13/i6/p1592_1 (Duality transformations of Abelian and non-Abelian gauge fields, by Stanley Deser and Claudio Teitelboim). It is well known that the source-free Maxwell equations $dF=0,\;d\;^\star F=0$ are invariant under duality transformations $$\mathbf{E}^\prime= \cos{\theta}\;\mathbf{E}+\sin{\theta}\;\mathbf{B},\;\;\mathbf{B}^\prime= \cos{\theta}\;\mathbf{B}-\sin{\theta}\;\mathbf{E}\;\;\;\;\;\;(1),$$ while the action functional $S=\frac{1}{2}\int\limits_{-\infty }^{\infty }dt\int\limits_{R^3}dV\;[\mathbf{E}^{2}-\mathbf{B}^{2}]$ is not. In fact the duality symmetry of the action should be implemented on the level of dynamical coordinates, that is the transverse part of the vector potential $\mathbf{A}_{\perp}$, with $\mathbf{\nabla}\cdot \mathbf{A}_{\perp}=0$. In temporal $A_0=0$ gauge, the action functional is $S=\frac{1}{2}\int\limits_{-\infty }^{\infty}dt\int\limits_{R^3}dV\;[\mathbf{\dot{A}}_{\perp }^{2}-\left( \mathbf{\nabla }\times \mathbf{A}_{\perp }\right) ^{2}]$. Deser and Teitelboim give an explicite (non-local) implementation of such a symmetry transformation as $$\mathbf{A}_{\perp }^\prime=\cos{\theta}\;\mathbf{A}_{\perp }-\sin{\theta}\;\nabla^{-2}\mathbf{\nabla}\times\dot{\mathbf{A}}_{\perp }\;\;\;\;\;\;(2),$$ and show that the action is invariant under the infinitesimal version of (2) because such a transformation alters the Lagrangian by a total time-derivative term (of Chern-Simons type) if sufficiently rapid falloff of fields at spatial infinity is assumed. The generator of this infinitesimal transformation, given by Deser and Teitelboim, is (in the sense that the changes in $\mathbf{E}$ and $\mathbf{A}$ are given by the Poisson brackets of those quantities with $\theta G$)

$$G=\frac{1}{2}\int\limits_{R^3}dV\;(\mathbf{B}\cdot\nabla^{-2}\mathbf{\nabla}\times\mathbf{B}+\mathbf{E}\cdot\nabla^{-2}\mathbf{\nabla}\times\mathbf{E})\;\;\;\;\;\;(3),$$ where $\mathbf{E}=-\dot{\mathbf{A}}_{\perp }$ and $\mathbf{B}=\mathbf{\nabla }\times \mathbf{A}_{\perp}$.

What is the finite transformation generated by (3)? It can not be (2), because on the mass shell, when $\ddot{\mathbf{A}}_{\perp }=\nabla^2 \mathbf{A}_{\perp }$, (2) reproduces (1) under which the action is not invariant (acquires a scale factor $\cos^2{\theta}-\sin^2{\theta}$ after the total time-derivative part is neglected).

Is here any analogy with the Wess-Zumino term which is closed (as a differential form) but not globally exact?